Open NullVoxPopuli opened 1 year ago
node 18, webpack 5
I have this plugin that I'm using in webpack:
const { createUnplugin } = require('unplugin'); const copyToPublic = createUnplugin((options) => { let { src, include, dest } = options ?? {}; dest ??= src; include ??= '**/*'; return { name: 'copy-files-to-public', async buildStart() { const files = globby.sync(include, { cwd: src }); await Promise.all( files.map(async (file) => { let source = path.join(src, file); this.addWatchFile(source); await this.emitFile({ type: 'asset', fileName: path.join(dest, file), source: fs.readFileSync(source).toString(), }); }) ); }, }; });
Like this:
plugins: [ copyToPublic.webpack({ src: 'docs' }), ], },
when I tried to use the watchChange hook, it was never called (no console.log's were logged) (I made sure to change a few of the files found by globby)
watchChange
No response
Environment
node 18, webpack 5
Reproduction
I have this plugin that I'm using in webpack:
Like this:
Describe the bug
when I tried to use the
watchChange
hook, it was never called (no console.log's were logged) (I made sure to change a few of the files found by globby)Additional context
No response
Logs
No response