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

fix(types): remove null from CSSModulesOptions.localsConvention #10904

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,9 @@ export interface CSSModulesOptions {
| ((name: string, filename: string, css: string) => string)
hashPrefix?: string
/**
* default: null
* default: undefined
*/
localsConvention?:
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly'
| null
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly'
}

const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)($|\\?)`
Expand Down Expand Up @@ -915,8 +910,7 @@ async function compileCSS(
postcssPlugins.unshift(
(await import('postcss-modules')).default({
...modulesOptions,
// TODO: convert null to undefined (`null` should be removed from `CSSModulesOptions.localsConvention`)
localsConvention: modulesOptions?.localsConvention ?? undefined,
localsConvention: modulesOptions?.localsConvention,
getJSON(
cssFileName: string,
_modules: Record<string, string>,
Expand Down