extract-css-chunks-webpack-plugin icon indicating copy to clipboard operation
extract-css-chunks-webpack-plugin copied to clipboard

bug: fails to find `bestMatch` under some situations

Open Timer opened this issue 4 years ago ā€¢ 14 comments

bestMatch is not always located before this branch is triggered.

As a result, there's a Cannot read property 'pop' of undefined error fired.

Here's a really small project that reproduces the issue: https://github.com/Timer/extract-css-chunks-webpack-plugin-bug

This same exact input works with mini-css-extract-plugin, so it might be worth finding where logic diverges!

Node: v12.14.1 extract-css-chunks-webpack-plugin: 4.7.4

Timer avatar Jan 24 '20 18:01 Timer

hmm okay. Ill re-sync with mini-css i have a PR open to that project anyways

ScriptedAlchemy avatar Jan 25 '20 00:01 ScriptedAlchemy

So the version in your repo you made was an older one. Either way im not able to replicate this

Are you sure youre using the latest copy? These projects are nearly the same at the moment

ScriptedAlchemy avatar Jan 25 '20 02:01 ScriptedAlchemy

this syncs it with mini-css and my performance improvement made (currently open pr) https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/pull/226/files

ScriptedAlchemy avatar Jan 25 '20 02:01 ScriptedAlchemy

perhaps rm -rf node_moduels, yarn cache clean, yarn --force

ScriptedAlchemy avatar Jan 25 '20 02:01 ScriptedAlchemy

So the version in your repo you made was an older one. Either way im not able to replicate this

Are you sure youre using the latest copy? These projects are nearly the same at the moment

Positive! See the yarn.lock file which has resolved to 4.7.4: https://github.com/Timer/extract-css-chunks-webpack-plugin-bug/blob/448c3b4974790c1e2c542f27525b49eacbcee083/yarn.lock#L2612-L2613

Timer avatar Jan 27 '20 12:01 Timer

I went ahead and explicitly upgraded the package to remove doubts: https://github.com/Timer/extract-css-chunks-webpack-plugin-bug/commit/39a5cb8b150b51577f5dfa32a5be2cc147867476

Timer avatar Jan 27 '20 12:01 Timer

āÆ rm -rf node_modules && git rev-parse HEAD && yarn install && yarn why extract-css-chunks-webpack-plugin && yarn next build

39a5cb8b150b51577f5dfa32a5be2cc147867476

yarn install v1.21.1
[1/4] šŸ”  Resolving packages...
[2/4] šŸšš  Fetching packages...
[3/4] šŸ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.4.0 || ^5.0.0".
warning "extract-css-chunks-webpack-plugin > [email protected]" has unmet peer dependency "webpack@^4.40.2".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
[4/4] šŸ”Ø  Building fresh packages...
āœØ  Done in 9.55s.

yarn why v1.21.1
[1/4] šŸ¤”  Why do we have the module "extract-css-chunks-webpack-plugin"...?
[2/4] šŸšš  Initialising dependency graph...
[3/4] šŸ”  Finding dependency...
[4/4] šŸš”  Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "extract-css-chunks-webpack-plugin"
info This module exists because it's specified in "devDependencies".
info Disk size without dependencies: "140KB"
info Disk size with unique dependencies: "732KB"
info Disk size with transitive dependencies: "6.02MB"
info Number of shared dependencies: 13
āœØ  Done in 0.57s.

yarn run v1.21.1
$ /Users/joe/Desktop/scratch/extract-css-chunks-webpack-plugin-bug/node_modules/.bin/next build
Warning: Production code optimization has been disabled in your project. Read more: https://err.sh/zeit/next.js/minification-disabled
Creating an optimized production build  

Failed to compile.

chunk styles
static/css/19d7f5d5.chunk.css
Cannot read property 'pop' of undefined

> Build error occurred
Error: > Build failed because of webpack errors
    at build (/Users/joe/Desktop/scratch/extract-css-chunks-webpack-plugin-bug/node_modules/next/dist/build/index.js:10:900)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Timer avatar Jan 27 '20 13:01 Timer

Any plans to solve this problem?

pavelzubov avatar Feb 10 '20 14:02 pavelzubov

The same problem for us. For now we downgrade to the version [email protected] and works good for now.

benitocas88 avatar Feb 10 '20 17:02 benitocas88

https://github.com/webpack-contrib/mini-css-extract-plugin/issues/341

fivethreeo avatar Mar 21 '20 18:03 fivethreeo

Is anyone willing to open a PR if they have found the exact issue? @Timer is there anything I need to do on my side to patch this?

ScriptedAlchemy avatar Apr 22 '20 01:04 ScriptedAlchemy

@ScriptedAlchemy we no longer use this plugin in Next.js, so I'm not sure.

The users who ran into this issue might know if it still reproduces: https://github.com/zeit/next.js/issues/10161

Timer avatar Apr 22 '20 04:04 Timer

Booooo!

Haha all good. Iā€™m maintaining mini-css more than this. Since I merged my hmr capabilities in, I only use this repo to test prereleases of mini css

ScriptedAlchemy avatar Apr 22 '20 04:04 ScriptedAlchemy

please any news about this? because i still stuck on this issue

ghost avatar Aug 17 '20 19:08 ghost