Skip to content
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

Specifying maxSize parameter causes incorrect ordering of CSS files #548

Closed
tstibbs opened this issue Jul 14, 2020 · 4 comments
Closed

Specifying maxSize parameter causes incorrect ordering of CSS files #548

tstibbs opened this issue Jul 14, 2020 · 4 comments

Comments

@tstibbs
Copy link

tstibbs commented Jul 14, 2020

  • Operating System: Ubuntu 16.04.2 LTS
  • Node Version: v12.14.1
  • NPM Version: 6.14.5
  • webpack Version: 4.43.0
  • mini-css-extract-plugin Version: 0.9.0

Expected Behavior

You should be able to set optimization.splitChunks.maxSize to limit the size of chunks.

Actual Behavior

Setting optimization.splitChunks.maxSize messes up the order that css is loaded on the page.

Code

Having the following in webpack.config.js will cause mis-ordering in some situations.

optimization: {
  splitChunks: {
    minSize: 1,
    maxSize: 2,
  },
},

How Do We Reproduce?

Smallest example I can come up with: https://github.com/tstibbs/mini-css-extract-bug

@alexander-akait
Copy link
Member

This is a problem. We don't guarantee order of chunks and if your CSS depends on cross-module order that won't work. I'm not aware of any simple fix to that. Do not rely on CSS rules order between modules. Sorry for delay

@tstibbs
Copy link
Author

tstibbs commented Mar 5, 2021

@alexander-akait are you saying that you don't guarantee order of chunks under any circumstance - i.e. you're saying that it's just luck that it's currently working for me even when not setting maxSize?

@alexander-akait
Copy link
Member

@tstibbs Yes, because in code you have right order, but we don't guarantee order

@alexander-akait
Copy link
Member

THe same problem - #959, bug on HtmlWebpackPlugin side, because we export the valid order

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

No branches or pull requests

2 participants