question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails build with `mini-css-extract-plugin`

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
prateekbhcommented, Jul 9, 2018

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

0reactions
Hocohcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

"TypeError: MiniCssExtractPlugin is not a constructor" in fresh ...
I expected npm run build to work without errors. Actual behavior. It produced the error TypeError: MiniCssExtractPlugin is not a constructor ...
Read more >
MiniCssExtractPlugin error when I run npm run build
I'm trying to run "Npm Run Build" on my reactjs website, but I keep getting this error ...
Read more >
`npm run build`, error `TypeError: MiniCssExtractPlugin is not ...
Solved — `npm run build`, error `TypeError: MiniCssExtractPlugin is not a constructor`. When running npm run build causes TypeError. Error: PS D:\ ****\ ......
Read more >
MiniCssExtractPlugin - webpack
It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS and SourceMaps. It builds on top of...
Read more >
You forgot add min-css-extract-plugin - Ionic Vue
Syntax Error: Error: You forgot to add 'mini-css-extract-plugin' plugin (i.e. { plugins: [new ... ERROR Error: Build failed with errors.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found