Laravel-mix: Unexpectedly fails with css-loader v4.0.0

Created on 27 Jul 2020  路  8Comments  路  Source: JeffreyWay/laravel-mix

Just a heads up that I'm seeing this error with css-loader v4.0.0:

TypeError: text.forEach is not a function
    at childCompiler.runAsChild (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/extract-text-webpack-plugin/dist/loader.js:145:16)
    at compile (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/webpack/lib/Compiler.js:343:11)
    at hooks.afterCompile.callAsync.err (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/webpack/lib/Compiler.js:681:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at compilation.seal.err (/Users/danielbachhuber/projects/foodbloggerpro/wp-content/node_modules/webpack/lib/Compiler.js:678:31)

Here's a corresponding thread on that repo: https://github.com/webpack-contrib/css-loader/issues/1135

The underlying culprit might be extract-text-webpack-plugin.

Most helpful comment

Updating laravel-mix to "6.0.0-alpha.1" allowed me to compile using "npm run dev". However, it killed my "npm run hot" process, reporting webpack-dev-server not being able to find webpack-cli/bin/config-yargs. Being an alpha version, I can't complain about that, but it means the workaround won't immediately work for some.

Luckily, I was able to get everything working again by simply rolling back to css-loader v3.6

All 8 comments

@JeffreyWay Hello, is there something to do on the laravel-mix side ?

Seems like it, I am facing the same issue with my clean Laravel 7 installations.

e.g error

ERROR in ./resources/sass/app.scss Module build failed (from ./node_modules/css-loader/dist/cjs.js): TypeError: text.forEach is not a function at childCompiler.runAsChild ({app dir}\node_modules\laravel-mix\node_modules\extract-text-webpack-plugin\dist\loader.js:145:16)

Updating the package.json file in the Laravel root dir to require "laravel-mix": "6.0.0-alpha.1" fixed this for me.

Updating laravel-mix to "6.0.0-alpha.1" allowed me to compile using "npm run dev". However, it killed my "npm run hot" process, reporting webpack-dev-server not being able to find webpack-cli/bin/config-yargs. Being an alpha version, I can't complain about that, but it means the workaround won't immediately work for some.

Luckily, I was able to get everything working again by simply rolling back to css-loader v3.6

Hi, folks!

Have the same problem after update laravel-mix from "laravel-mix": "^5.0.4" to "laravel-mix": "^5.0.5"

npm run watch and npm run dev work without errors, but npm run prod fire this errors:

ERROR in ./protected/modules/backend/views/assets-dev/sass/main/main.scss (./node_modules/css-loader/dist/cjs.js??ref--90-2!./node_modules/postcss-loader/src??postcss85!./node_modules/sass-loader/dist/cjs.js??ref--90-4!./protected/modules/backend/views/assets-dev/sass/main/main.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: decl.moveTo is not a function

when I'm rollback to "laravel-mix": "^5.0.4" all work just fine.

any ideas? Thanks

Fixed in upcoming release.

I'm seeing this in 5.0.9, what was the fix @JeffreyWay ?

I was seeing it come from ./node_modules/css-loader/dist/cjs.js when parsing less files.

I'm having the same issue as @joelpittet, but am unable to find how to fix it. Any ideas?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

terion-name picture terion-name  路  3Comments

Bomavi picture Bomavi  路  3Comments

Micaso picture Micaso  路  3Comments

nezaboravi picture nezaboravi  路  3Comments

amin101 picture amin101  路  3Comments