mrbar42 / ignore-emit-webpack-plugin

Prevents ignored files from being emitted during a Webpack build
MIT License
18 stars 1 forks source link

TypeError: Cannot read property 'tap' of undefined with latest version #17

Closed lukemiller93 closed 3 years ago

lukemiller93 commented 3 years ago
/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/ignore-emit-webpack-plugin/index.js:64
                compilation.hooks.processAssets.tap({

TypeError: Cannot read property 'tap' of undefined
    at /mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/ignore-emit-webpack-plugin/index.js:64:49
    at SyncHook.eval [as call] (eval at create (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)        
    at SyncHook.lazyCompileHook (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/webpack/lib/Compiler.js:631:26)
    at /mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/webpack/lib/Compiler.js:662:28)
    at /mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/webpack/lib/Watching.js:77:18
    at _next0 (eval at create (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
    at eval (eval at create (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:1)
    at LiveReloadPlugin.serverStarted (/mnt/c/Users/luke/Local Sites/electrify/app/public/wp-content/plugins/cbc-blocks/blocks/testimonial/node_modules/webpack-livereload-plugin/index.js:89:9)
helgatheviking commented 3 years ago

Seeing the same! Looks like a similar usage too... Linux subsystem? And running wp-scripts to compile a WordPress plugin?

helga@Lexa:/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies$ sudo npm run build

> radio-buttons-for-taxonomies@2.1.0 build /mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies
> wp-scripts build

/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/ignore-emit-webpack-plugin/index.js:64
                compilation.hooks.processAssets.tap({
                                                ^

TypeError: Cannot read property 'tap' of undefined
    at /mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/ignore-emit-webpack-plugin/index.js:64:49
    at SyncHook.eval [as call] (eval at create (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)
    at SyncHook.lazyCompileHook (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:631:26)
    at hooks.beforeCompile.callAsync.err (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:667:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:662:28)
    at readRecords.err (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:321:11)
    at Compiler.readRecords (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:529:11)
    at hooks.run.callAsync.err (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:318:10)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.beforeRun.callAsync.err (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:315:19)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.run (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/lib/Compiler.js:312:24)
    at processOptions (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack-cli/bin/cli.js:353:14)
    at yargs.parse (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack-cli/bin/cli.js:364:3)
    at Object.parse (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack-cli/node_modules/yargs/yargs.js:576:18)
    at /mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/mnt/c/Users/helga/Local Sites/sandbox/app/public/wp-content/plugins/Radio-Buttons-for-Taxonomies/node_modules/webpack/bin/webpack.js:156:2)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! radio-buttons-for-taxonomies@2.1.0 build: `wp-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the radio-buttons-for-taxonomies@2.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-10-28T22_36_47_365Z-debug.log
helgatheviking commented 3 years ago

I rolled back with npm install ignore-emit-webpack-plugin@2.0.3 --save-dev and the WP scripts work again. npm run build actually builds something.

kerm1it commented 3 years ago

I have the same problem.

I think you should revert it and publish a patch version.

If you need to support webpack 5, you should publish a major version. Because it has some break changes.

temoedjin commented 3 years ago

Same problem here. If you could publish it as a major version that would be perfect. Now changed the dependency to point to a specific minor version (so similar to @helgatheviking )

ankitrox commented 3 years ago

Similar issue here, however solution suggested by @helgatheviking seems to be working fine.

yoyo837 commented 3 years ago

@mrbar42

Stanzilla commented 3 years ago

Yep, same here

mrbar42 commented 3 years ago

Should be fixed in https://github.com/mrbar42/ignore-emit-webpack-plugin/releases/tag/v2.0.5

Stanzilla commented 3 years ago

@mrbar42 in 2.0.5 it's

[webpack-cli] Compilation finished
Unhandled rejection TypeError: Cannot read property 'source' of undefined
    at /home/stan/projects/work/platform-documentation/mkdocs-material/node_modules/webpack/lib/SourceMapDevToolPlugin.js:187:47
gziolo commented 3 years ago

I see a different issue with v2.0.5 and webpack 4, it works properly with v2.0.3:

TypeError: Cannot destructure property 'info' of 'TerserPlugin.getAsset(...)' as it is undefined.
    at TerserPlugin.taskGenerator (/Users/gziolo/Projects/esnext-example/node_modules/terser-webpack-plugin/dist/index.js:183:7)
    at taskGenerator.next (<anonymous>)
    at /Users/gziolo/Projects/esnext-example/node_modules/terser-webpack-plugin/dist/index.js:455:49
    at /Users/gziolo/Projects/esnext-example/node_modules/p-try/index.js:4:10
    at new Promise (<anonymous>)
    at pTry (/Users/gziolo/Projects/esnext-example/node_modules/p-try/index.js:3:37)
    at run (/Users/gziolo/Projects/esnext-example/node_modules/terser-webpack-plugin/node_modules/p-limit/index.js:24:18)
    at /Users/gziolo/Projects/esnext-example/node_modules/terser-webpack-plugin/node_modules/p-limit/index.js:46:18
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
mrbar42 commented 3 years ago

@gziolo Please re-check with the latest v2.0.6

gziolo commented 3 years ago

@mrbar42, I tested locally with the new version and I can confirm that it works correctly with v2.0.6. Thank you for fixing this issue 🎉