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

Allow css loaders to specify dependencies on other css files #530

Closed
barak007 opened this issue May 13, 2020 · 6 comments
Closed

Allow css loaders to specify dependencies on other css files #530

barak007 opened this issue May 13, 2020 · 6 comments

Comments

@barak007
Copy link
Contributor

  • Operating System: All
  • Node Version: 12
  • NPM Version: All
  • webpack Version: 4
  • mini-css-extract-plugin Version: 0.9.0

Feature Proposal

Allow css loaders to specify dependencies on other css files only for extract sorting purposes.
Right now I consider the behavior a bug since every other loader can use imports to any file.

Feature Use Case

I made a small project to demonstrate the goal and the issue of the current behavior.
All explained in the readme.

https://github.com/barak007/mini-extract-issue

@barak007
Copy link
Contributor Author

Hi @sokra we are trying to move from our webpack plugin to a more simplified loader that works with other webpack echo system, and will be forward compatible with webpack@5. any chance that you can take a look?

@tomrav
Copy link

tomrav commented Jun 24, 2020

Hi @evilebottnawi, we'd really appreciate it if you could take a look at this issue, it would help us greatly downstream.

@alexander-akait
Copy link
Member

@tomrav @barak007 css-loader and mini-css-extract-plugin in my roadmap on the next month, sorry a lot of work, but I don't forget about it, if you really need this right now, you can send a PoC, if it is will be good written we will merge this ASAP

@tomrav
Copy link

tomrav commented Jun 24, 2020

Thank you for replying so quickly, I'm not sure we're familiar enough with the required internals to implement this ourselves, perhaps with some guidance we could. Otherwise once you get around to this issue we'd love to help out.

@alexander-akait
Copy link
Member

Sorry for delay, problem here you use require('./compA.css') so webpack runs your loader on import again, but you can use require('!!./compA.css')

@alexander-akait
Copy link
Member

Closed in favor of #555, also there are some solution:

  1. Use CSS modules to avoid such sutiation (especial composition)
  2. Don't rely on CSS order between modules (it can be unsafe in many situation)
  3. Also you can use @import, but it is still not solve the problem with order between modules

Also maybe we will provide an option to control it, but the such sulation is not easy to solve, also you can always make a plugin and implement any 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

3 participants