vue-cli: Module build failed: TypeError: this[NS] is not a function

Version

3.0.0-rc.3

Reproduction link

https://github.com/vuejs/vue-cli

Steps to reproduce

I’m getting this error when executing the build command.

I’ve reduced it back to a clean project created with a fresh install of the cli. The error appears to throw on App.vue and HelloWorld.vue

What is expected?

No errors

What is actually happening?

Errors


Here’s the full body of the error

 ERROR  Failed to compile with 2 errors                                                                         23:09:16
 error  in ./src/App.vue?vue&type=style&index=0&lang=scss

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: this[NS] is not a function
    at childCompiler.runAsChild (C:\users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\mini-css-extract-plugin\dist\loader.js:148:15)
    at compile (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\webpack\lib\Compiler.js:296:11)
    at hooks.afterCompile.callAsync.err (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\webpack\lib\Compiler.js:553:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\Hook.js:35:21)
    at compilation.seal.err (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\webpack\lib\Compiler.js:550:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.optimizeAssets.callAsync.err (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\webpack\lib\Compilation.js:1283:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.optimizeChunkAssets.callAsync.err (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\webpack\lib\Compilation.js:1274:32)
    at _err1 (eval at create (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:15:1)
    at C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\uglifyjs-webpack-plugin\dist\index.js:282:11
    at _class.runTasks (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\uglifyjs-webpack-plugin\dist\uglify\index.js:63:9)
    at UglifyJsPlugin.optimizeFn (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\uglifyjs-webpack-plugin\dist\index.js:195:16)
    at _fn0.then._result0 (eval at create (C:\Users\chase\desktop\dev\vue-cordova-test\one-more-time\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:11:1)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

 @ ./src/App.vue?vue&type=style&index=0&lang=scss 1:0-463 1:479-482 1:484-944 1:484-944
 @ ./src/App.vue
 @ ./src/main.js
 @ multi ./src/main.js

I noticed the mention of “mini-css-extract-plugin” and found this issue but haven’t been able to resolve the issue.

I searched package-lock and noticed that the plugin is a dependency of vue cli-service, and hoping I might find some solution here. The only other thing I could say is that I’m on Windows 10.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (6 by maintainers)

Most upvoted comments

I found it’s a case sensitive issue in the path. I talked about it in this issue: https://github.com/webpack-contrib/mini-css-extract-plugin/issues/73#issuecomment-416643790

@Aymkdn, @vpeti I confirm.

rem CMD works.
C:\>cd \temp\1\f
C:\TEMP\1\F>npm run build
# PowerShell with correct register works.
PS C:\>cd \TEMP\1\F
PS C:\TEMP\1\F>npm run build
# PowerShell with different register fails.
PS C:\>cd \temp\1\f
PS C:\temp\1\f>npm run build

@chasebank @dermeister0 on Windows using cmd instead of powershell solved this for me