Important! This issue got fixed directly in Vite codebase, so this package will be deprecated. If you still encounter this error make sure that you're using @vitejs/plugin-vue in version newer than
3.0.0
. If you do - please file new bug request on Vite repository.
By default, @vitejs/plugin-vue
version 2 adds a CSS Module into the output JS bundle every time it's used in your component via <style module lang="scss" src="somemodule.scss"></style>
syntax. This plugin for vite deduplicates CSS Modules in your Vue application bundle leaving them only once! 🚀
npm install @frsource/vite-plugin-vue-dedupe-css-modules --save-dev
# or
yarn add @frsource/vite-plugin-vue-dedupe-css-modules --dev
import { defineConfig } from 'vite';
import vueDedupeCSSModulesPlugin from '@frsource/vite-plugin-vue-dedupe-css-modules';
export default defineConfig({
plugins: [vueDedupeCSSModulesPlugin({ /** Options */ })],
});
This plugin can be configured using the configuration options below:
- Type:
string | string[]
- Default:
['src/**/*.css', 'src/**/*.less', 'src/**/*.styl', 'src/**/*.scss', 'src/**/*.sass', 'src/**/*.vue']
A single file, or array of files, to include when linting.
- Type:
string | string[]
- Default:
'node_modules'
A single file, or array of files, to exclude when linting.
This project is using yarn version 3. Make sure to use yarn set version latest
to download it before doing any changes.
MIT