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

[mini-css-extract-plugin] ignoreOrder #7

Closed
yuri-scarbaci-lenio opened this issue Mar 12, 2020 · 3 comments
Closed

[mini-css-extract-plugin] ignoreOrder #7

yuri-scarbaci-lenio opened this issue Mar 12, 2020 · 3 comments

Comments

@yuri-scarbaci-lenio
Copy link

First of all thanks a lot for the plugin!

I'm facing an issue where the build process goes a little bombastick about not being able to get a definitive order of the imported scss, I suspect due to the nature of how next.js handles the building process...

I do understand that getting a working configuration that doesn't throw the warning left and right will be almost impossible since it's deeply tied to next.js and it's not even worth given how subject to change it is, but what would be really nice is the ability to configure the mini-css-extract-plugin to pass the ignoreOrder flag...

I'm especially referring to this issue with mini-css-extract

Maybe add miniCssExtractOptions on this line
and spread the options on this line
so we can configure the mini-css-extract plugin ourself in a similar fashion as we do with the other plugins?

also by nature I think that if css/sass modules are enabled and we are getting pretty much scoped css anyway, we would want to default the option of ignoring the order to true by default?

P.S.
this is an example of the error I'm getting:

Compiled with warnings.

chunk styles [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/sass-loader/dist/cjs.js!./components/path/to/file.module.scss
despite it was not able to fulfill desired ordering with these modules:
 * css ./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/sass-loader/dist/cjs.js!./components/path/to/another/file.module.scss
 - couldn't fulfill desired order of chunk group(s) static/A2QMGgGL_4dyHrB5ko63S/pages/path/to/page.js
...

this is not only annoying, this would prevent configuring CI & CD pipelines that fails on warning...

@yuri-scarbaci-lenio
Copy link
Author

yuri-scarbaci-lenio commented Mar 12, 2020

As an additional source of the problem I will link this medium article where an alternate solution is given, but the alternate solution actually remove all the css chunking magic from the process and I would strongly not recommend doing it to solve the problem with 'css modules' since by nature they should not depend on a given order of css import.

@webdeb
Copy link
Owner

webdeb commented Mar 13, 2020

@yuri-scarbaci-lenio Thanks, I think it makes sense.

Maybe add miniCssExtractOptions on this line
and spread the options on this line
so we can configure the mini-css-extract plugin ourself in a similar fashion as we do with the other plugins?

Yeah, why not. I am open if you provide a PR for this

@yuri-scarbaci-lenio
Copy link
Author

@webdeb
Created the PR and tested it against my local project, works as expected.

I took the freedom to

  • update the README.md file to reflect the change and explain how to easly contribuite to this repository
  • fix all the npm audit problems
  • create the CHANGELOG.md file to keep tracks of the changes

webdeb added a commit that referenced this issue Mar 13, 2020
@webdeb webdeb closed this as completed Mar 13, 2020
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