css-minimizer-webpack-plugin: SourceMap option does not work on GitLab CI

  • Operating System: GitLab CI - Docker/Ubuntu
  • Node Version: 14.15.3
  • NPM Version: 6.14.9
  • webpack Version: 5.11.1
  • css-minimizer-webpack-plugin Version: 1.1.5

Expected Behavior

Should produce a sourcemap on GitLab CI in the same way as on my local machine.

Actual Behavior

Fails with the following error message:

(node:47) UnhandledPromiseRejectionWarning: Error: "version" is a required argument.
    at Object.getArg (/builds/ofhouse/stackoverflow-65355772/node_modules/source-map/lib/util.js:24:11)
    at new BasicSourceMapConsumer (/builds/ofhouse/stackoverflow-65355772/node_modules/source-map/lib/source-map-consumer.js:294:22)
    at new SourceMapConsumer (/builds/ofhouse/stackoverflow-65355772/node_modules/source-map/lib/source-map-consumer.js:22:7)
    at SourceMapSource.node (/builds/ofhouse/stackoverflow-65355772/node_modules/webpack-sources/lib/SourceMapSource.js:193:4)
    at exports.getSourceAndMap (/builds/ofhouse/stackoverflow-65355772/node_modules/webpack-sources/lib/helpers.js:20:27)
    at SourceMapSource.sourceAndMap (/builds/ofhouse/stackoverflow-65355772/node_modules/webpack-sources/lib/SourceMapSource.js:184:10)
    at getTaskForFile (/builds/ofhouse/stackoverflow-65355772/node_modules/webpack/lib/SourceMapDevToolPlugin.js:78:30)
    at /builds/ofhouse/stackoverflow-65355772/node_modules/webpack/lib/SourceMapDevToolPlugin.js:266:22
    at /builds/ofhouse/stackoverflow-65355772/node_modules/webpack/lib/Cache.js:93:5
    at Hook.eval [as callAsync] (eval at create (/builds/ofhouse/stackoverflow-65355772/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)

Code

Reproduction repository: https://gitlab.com/ofhouse/stackoverflow-65355772

How Do We Reproduce?

  1. Checkout the repository locally and run npm run build (success)
  2. Upload it to GitLab.com and let GitLab CI run (fails) Example output from the current HEAD of the repository: https://gitlab.com/ofhouse/stackoverflow-65355772/-/jobs/945541367

I’ve tried out many different setups but I always fail to reproduce the issue locally. Even running inside the same docker image with

docker run --rm -v $(pwd):/tmp node:14-alpine sh -c "cd /tmp && npm ci && npm run build"

does not let me reproduce the issue.

I have no idea how I could abstract this issue further, so my hope is that somebody here has an idea what’s happening 🙏.

Edit: What it makes it even stranger is that it also runs successfully on GitHub actions: https://github.com/ofhouse/stackoverflow-65355772/runs/1652026529

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (18 by maintainers)

Most upvoted comments

Upgraded to v1.2.0, webpack builds perfectly here. Thank you! 🙌

Ok found something:

Setting parallel: false on my local machine lets me reproduce the issue locally (tested it with 2 different machines). So the GitLab machine triggers parallel: false by default based on the available CPU cores. So my guess is that the issue only appears on machines with a single CPU core.