Css-loader: update after new version to report cannot read property 'split' of undefined mini-css-extract-plugin

Created on 3 Dec 2019  ·  5Comments  ·  Source: webpack-contrib/css-loader

I reported the following error after using webpack build code:

ERROR in ./view/pages/activitiesList/components/brand.scss
Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ../node_modules/happypack/loader.js):
TypeError: Cannot read property 'split' of undefined

=========================

  • Operating System: Mac 10.15.1
  • Node Version: 10.16.0
  • NPM Version: 6.9.0
  • webpack Version: ^4.39.3
  • css-loader Version: ^3.2.1
    -mini-css-extract-plugin: "^0.8.0"

Expected Behavior

Success!

Actual Behavior

ERROR in ./view/pages/activitiesList/components/brand.scss
Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ../node_modules/happypack/loader.js):
TypeError: Cannot read property 'split' of undefined
at Object.loader (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/css-loader/dist/index.js:85:33)
at applySyncOrAsync (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/applyLoaders.js:350:21)
at apply (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/applyLoaders.js:277:5)
at /Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/applyLoaders.js:283:9
at postcss.process.then (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/postcss-loader/src/index.js:197:9)
at runLoaders (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/webpack/lib/NormalModule.js:316:20)
at /Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/HappyPlugin.js:199:7
at Object. (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/HappyThreadPool.js:85:9)
at ChildProcess. (/Users/kevin/Documents/secoo_project/transaction-full-return/node_modules/happypack/lib/HappyThread.js:86:32)
at ChildProcess.emit (events.js:198:13)
at emit (internal/child_process.js:832:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

Code

HappyPackPluginCSS = new HappyPack({ //开启多线程打包
        id: 'css',
        verbose: false,
        loaders: ['css-loader'],
        threadPool: happyThreadPool
    }),
    HappyPackPluginSCSS = new HappyPack({ //开启多线程打包
        id: 'scss',
        verbose: false,
        loaders: [{
            loader: 'css-loader',
            options: {
                importLoaders: 2
            }
        }, 'postcss-loader', 'sass-loader'],
        threadPool: happyThreadPool

Most helpful comment

Can be rolled back to [email protected] for repair!

All 5 comments

Can be rolled back to [email protected] for repair!

Looks problem in HappyPack plugin, please create reproducible test repo

Problem what somebody remove remainingRequest andcurrentRequest` from loader context, without this loader can't work

After investigate problem here https://github.com/amireh/happypack/blob/6549ad0a9b2d3af98d62401af8cc9c2e1b812635/lib/applyLoaders.js#L90, happy pack should provide remainingRequest and currentRequest in loader context, sorry we can't do anything on our side, my recommendation is do not use happy pack due he is very buggy

roll back to
"css-loader": "^3.2.0",
work for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathanong picture jonathanong  ·  3Comments

grydstedt picture grydstedt  ·  3Comments

camsong picture camsong  ·  3Comments

fengyun2 picture fengyun2  ·  4Comments

Jessidhia picture Jessidhia  ·  3Comments