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

how to css-module the common cssfile ? #3135

Closed
Summer-andy opened this issue Apr 25, 2021 · 2 comments
Closed

how to css-module the common cssfile ? #3135

Summer-andy opened this issue Apr 25, 2021 · 2 comments

Comments

@Summer-andy
Copy link

Describe the bug

*.module.scss or *.module.css file can be css-module. for example,

test.module.css

.container {
   width: 100px
}
import style from 'test.module.css'

this style is Object, because the test.module.css has been css-module。

now,

test.css

.container {
   width: 100px
}

i want this file test.css also can be css-module.

How should I configure it ?

Reproduction

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
    OS: macOS Mojave 10.14.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 1.25 GB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Chrome: 90.0.4430.85
    Firefox: 88.0
    Safari: 12.0.3
  npmPackages:
    vite: ^2.1.5 => 2.2.1

Used package manager:

yarn

@patak-dev
Copy link
Member

Please check this comment #2116 (comment), this is not something that is supported by Vite. You may be able to create a plugin for it though.

For this kind of question, please start a GitHub Discussion or join the chat at Vite Land to discuss with others.

@Summer-andy
Copy link
Author

Summer-andy commented Apr 26, 2021

i have create a plugin to support it ! https://github.com/Summer-andy/vite-plugin-transform-css-modules

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants