You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
function build(){
let result = getESM(path.resolve(baseDir, './config.js'));
console.log(result);
}
build();
fs.watch(baseDir,{ persistent: true, recursive: true },(, filename)=>{
console.log(,filename);
build()
});
`
When I change the config.js file, the result is still cached before.
node : v16.13.1
npm: 8.1.2
The text was updated successfully, but these errors were encountered:
`const fs = require('fs');
const path = require('path');
require('@babel/register')({
cache: false,
});
process.env.ESM_DISABLE_CACHE = true
const requireModule = require('esm')(module, {
cache: false, cjs: { cache: false }, force: true }
);
const getESM = (path)=>{
let esmModule = {};
try {
esmModule = requireModule(path);
} catch (e) {
console.trace('requireModule Error:', e);
}
//本地开发时,fs.watch重新打包时有问题
return esmModule.default || esmModule;
}
const baseDir = path.resolve(__dirname,"./src");
function build(){
let result = getESM(path.resolve(baseDir, './config.js'));
console.log(result);
}
build();
fs.watch(baseDir,{ persistent: true, recursive: true },(, filename)=>{
console.log(,filename);
build()
});
`
When I change the config.js file, the result is still cached before.
node : v16.13.1
npm: 8.1.2
The text was updated successfully, but these errors were encountered: