Skip to content

v5.1.3 got compile error #1280

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

Closed
McDaddy opened this issue Mar 24, 2021 · 3 comments · Fixed by #1281
Closed

v5.1.3 got compile error #1280

McDaddy opened this issue Mar 24, 2021 · 3 comments · Fixed by #1281

Comments

@McDaddy
Copy link

McDaddy commented Mar 24, 2021

  • Operating System: MacOS Big Sur 11.2.3
  • Node Version: 12.15.0
  • NPM Version: 6.14.11
  • webpack Version: 5.27.2
  • css-loader Version: 5.1.3

Expected Behavior

Everything went well when css-loader version is 5.1.2 or below. After upgrade to 5.1.3, I got compile error in production mode(with mini-css-extract-plugin), but works well in development mode.

ERROR in ./app/styles/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 2)
Cannot read property 'matchResource' of undefined

    at getModulesOptions (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/css-loader/dist/utils.js:148:25)
    at normalizeOptions (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/css-loader/dist/utils.js:238:26)
    at Object.loader (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/css-loader/dist/index.js:45:43)
    at processResult (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/webpack/lib/NormalModule.js:674:19)
    at /Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/webpack/lib/NormalModule.js:773:5
    at /Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:195:20
    at context.callback (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at Object.callback (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/thread-loader/dist/index.js:52:7)
    at done (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/neo-async/async.js:8069:18)
    at callback (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/thread-loader/dist/WorkerPool.js:183:19)
    at /Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/thread-loader/dist/WorkerPool.js:217:15
    at mapSeries (/Users/chenweitao/work/GitHome/dice-fdp-ui/node_modules/neo-async/async.js:3625:14)
 @ ./app/fdp/pages/workspace-selector/index.tsx 77:0-29
 @ container entry ./WorkspaceSelector[0]

BTW, WorkspaceSelector is a webpack module federation Component

Actual Behavior

the call stack shows the error happens in the latest changed code in v5.1.3. Can u please advise how to fix it

image

Code

My config

{
          test: /\.(scss)$/,
          include: [
            resolve('app'),
            resolve('node_modules/@terminus/nusi'),
          ],
          use: [
            MiniCssExtractPlugin.loader
            'thread-loader',
            {
              loader: 'css-loader',
              options: {
                url: false,
                sourceMap: false,
              },
            },
            'postcss-loader',
            {
              loader: 'sass-loader',
              options: {
                sourceMap: false,
                webpackImporter: false,
              },
            },
          ],
  },

// plugin
new MiniCssExtractPlugin(
      {
        filename: 'style/[name].[chunkhash].css',
        chunkFilename: 'style/[id].css', // webpack5 required
      },
    ),
@alexander-akait
Copy link
Member

Bug in thread-loader, I will fix it, but some features will not work

@McDaddy
Copy link
Author

McDaddy commented Mar 24, 2021

Bug in thread-loader, I will fix it, but some features will not work

thank u! please let me once get updated

@alexander-akait
Copy link
Member

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

Successfully merging a pull request may close this issue.

2 participants