Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails build with mini-css-extract-plugin #4

Closed
prateekbh opened this issue May 25, 2018 · 8 comments
Closed

Fails build with mini-css-extract-plugin #4

prateekbh opened this issue May 25, 2018 · 8 comments

Comments

@prateekbh
Copy link
Owner

If mini-css-extract-plugin is added with this plugin, it gives the following error.

ERROR in ./style.css
    Module build failed: TypeError: this[NS] is not a function
        at childCompiler.runAsChild (/Users/prateekbh/projects/webpack-exp/node_modules/mini-css-extract-plugin/dist/loader.js:148:15)
        at compile (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compiler.js:242:11)
        at hooks.afterCompile.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compiler.js:487:14)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at compilation.seal.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compiler.js:484:30)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at hooks.optimizeAssets.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:966:35)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at hooks.optimizeChunkAssets.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:957:32)
        at _err0 (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:11:1)
        at /Users/prateekbh/projects/webpack-exp/node_modules/uglifyjs-webpack-plugin/dist/index.js:334:11
        at _class.runTasks (/Users/prateekbh/projects/webpack-exp/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:63:9)
        at UglifyJsPlugin.optimizeFn (/Users/prateekbh/projects/webpack-exp/node_modules/uglifyjs-webpack-plugin/dist/index.js:253:16)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:7:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at hooks.additionalAssets.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:952:36)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at hooks.optimizeTree.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:948:32)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
        at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/Hook.js:35:21)
        at Compilation.seal (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:890:27)
        at hooks.make.callAsync.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compiler.js:481:17)
        at _err0 (eval at create (/Users/prateekbh/projects/webpack-exp/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:11:1)
        at _addModuleChain (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:758:12)
        at processModuleDependencies.err (/Users/prateekbh/projects/webpack-exp/node_modules/webpack/lib/Compilation.js:697:9)
        at _combinedTickCallback (internal/process/next_tick.js:131:7)
        at process._tickCallback (internal/process/next_tick.js:180:9)
     @ ./index.js 3:0-22

As a first time plugin dev i have no idea what this means. Please help

@prateekbh
Copy link
Owner Author

@ev1stensberg by any chance you know this?

@developit
Copy link
Contributor

Ooooh I have run into this. You can't use mini-css-extract-plugin in a child compiler. You have to manually exclude it from plugins when creating the child compiler instance.

@prateekbh
Copy link
Owner Author

ohk.. but then how will js compiled in a child compiler know about the css?

@prateekbh
Copy link
Owner Author

excluding might have worked... and made me realized that i know so less about webpack 😢

@evenstensberg
Copy link

It's an intense tool 😆

@prateekbh
Copy link
Owner Author

Exclusion works

@Hocoh
Copy link

Hocoh commented Jul 7, 2018

Hi can you put the working code on the discussion hence we can figure out the modifications realized that have cured your program

@prateekbh
Copy link
Owner Author

Being a beginner, I forgot to send plugins in the SingleEntryPoint again.
https://github.com/prateekbh/babel-esm-plugin/blob/master/src/index.js#L31

This fixed my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants