-
-
Notifications
You must be signed in to change notification settings - Fork 147
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS modules support for Vite #1948
Comments
With our current convention, it's easy to have everything as css modules, but not easy to have some css modules and some non-css modules. Though if we are to encourage option 2, existing applications will be "left out", and break, some apps have been going on for awhile, so we may need to have a strategy to help app migrate to the new convention. |
Existing app should still work, we would not remove the existing global config for css modules. BTW exiting global config for css modules would not work for vite. Options 2 adds file based css modules support without explicit configuration. The question is do we want to support that vite conventions in other bundlers' setup. If it's a vite only conventions, it's bit confusing for other setups. It might be tricky to support it in other bundlers. |
What if css module can be configured from our html? <import from="my.css" type="css-module"> With this as the base, we can configure the webpack loader/vite plugin to do necessary work to turn the css into a css module file/virtual file. With this, we will have the ability to have standard css together with css module <import from="my.css">
<import from="my.modules.css" type="css-module"> |
We might just leave vite as special. I think your proposal needs option 1 instead, the vite plugin. |
You meant if an apps use Vite and wants to have css module it needs to have |
Yes. |
Yeah ok lets just leave it alone, we can try something later. We just need to have it as a mean to develop plugin for now. Its not even in the official list yet. |
Parcel also uses But it provided global option to use css-module on all files. We probably can remove the usage of that global option, make parcel and vite the same. |
maybe we can just flip it and make webpack follow that convention? Or we can just leave webpack alone and force the convention |
Yes, we can make webpack follow the convention too. Consistence feels better. |
馃挰 RFC
Currently Aurelia 2 setup with CSS modules does not work with Vite bundler.
馃敠 Context
Aurelia 2 has conventions that when using CSS modules, the css file name should still match js/ts/html file names. For example
my-comp.css(scss/less)
to matchmy-comp.html
andmy-comp.ts(js)
.However Vite has different conventions, it only works with file name
my-comp.module.css(scss/less)
, and it decided not to make it flexible with alternative setup. vitejs/vite#2981For us to support CSS module in Vite,
.module.css
naming conventions.Both options seem approachable. Option 2 might be slightly easier because it's in our control.
The text was updated successfully, but these errors were encountered: