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

Multi-entry point config: Ordering not matching JS import order #115

Closed
bawjensen opened this issue Apr 29, 2018 · 2 comments · Fixed by #130
Closed

Multi-entry point config: Ordering not matching JS import order #115

bawjensen opened this issue Apr 29, 2018 · 2 comments · Fixed by #130

Comments

@bawjensen
Copy link
Contributor

bawjensen commented Apr 29, 2018

Versions involved:

Node: v8.10.0

package.json:

"dependencies": {
  "css-loader": "^0.28.11",
  "mini-css-extract-plugin": "^0.4.0",
  "style-loader": "^0.21.0",
  "webpack": "^4.6.0",
  "webpack-cli": "^2.0.15"
}

Example project showing the bug in question: https://github.com/bawjensen/mcep-order-bug

You can see I have two entry points, entry-one.js and entry-two.js. They import their styling in a different order from each other, importing one.css then two.css or vice versa. However, as you can see in the dist-example/output-one.css/dist-example/output-two.css built files, their ordering is the same as each other, both having the .two {...} styling before the .one {...}.

You can see the versions of packages in question in the package.json, but I just built this example from scratch with the latest version of each package in question (webpack, css-loader, mini-css-extract-plugin).

Note, I left style-loader in the repo in case someone wants to try it themselves - I could not replicate this bug with style-loader, it injects the styles in the correct order into <style> tags. It seems to be specific to MCEP.

Also, I could not replicate the bug with a single entry point, it seems it must be two (or more).

Something even more odd about this particular bug: If you build the code as it stands in the repo, and then alter entry-one.js by commenting out one of the imports, output-two.css changes despite entry-two.js not having been modified. This happens when running yarn webpack with or without the --watch flag.

@alexander-akait
Copy link
Member

@bawjensen thanks for issue, maybe problem inside in webpack, feel free to investigate problem and send PR 👍

@bawjensen
Copy link
Contributor Author

@evilebottnawi if it were an issue within webpack itself I would've assumed the CSS ordering would be broken for style-loader like it is for MCEP. But as I mentioned the CSS gets injected into the DOM in the correct order.

I could be off-base here. My familiarity with webpack plugins is pretty minimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants