Skip to content

Comments

fix(css): show correct error when unknown placeholder is used for CSS modules pattern in lightningcss#19070

Merged
sapphi-red merged 1 commit intovitejs:mainfrom
sapphi-red:fix/css-lightning-css-invalid-pattern
Dec 25, 2024
Merged

fix(css): show correct error when unknown placeholder is used for CSS modules pattern in lightningcss#19070
sapphi-red merged 1 commit intovitejs:mainfrom
sapphi-red:fix/css-lightning-css-invalid-pattern

Conversation

@sapphi-red
Copy link
Member

Description

When css.lightningcss.cssModules.pattern: '[local]__[hash:base64:5]' is set, the following error happened:

[vite] Internal server error: Cannot read properties of undefined (reading 'replace')
Plugin: vite:css
File: /path/to/root/foo.module.css

With this PR, the error becomes:

[vite] Internal server error: [lightningcss] Error parsing CSS modules pattern: unknown placeholder "[hash:base64:5]" at index 9
Plugin: vite:css
File: /path/to/root/foo.module.css

@sapphi-red sapphi-red added feat: css p2-edge-case Bug, but has workaround or limited in scope (priority) labels Dec 25, 2024
@sapphi-red sapphi-red merged commit 9290d85 into vitejs:main Dec 25, 2024
16 checks passed
@sapphi-red sapphi-red deleted the fix/css-lightning-css-invalid-pattern branch December 25, 2024 06:39
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Dec 26, 2024
| datasource | package | from  | to    |
| ---------- | ------- | ----- | ----- |
| npm        | vite    | 6.0.5 | 6.0.6 |


## [v6.0.6](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small606-2024-12-26-small)

-   fix: replace runner-side path normalization with `fetchModule`-side resolve ([#18361](vitejs/vite#18361)) ([9f10261](vitejs/vite@9f10261)), closes [#18361](vitejs/vite#18361)
-   fix(css): resolve style tags in HTML files correctly for lightningcss ([#19001](vitejs/vite#19001)) ([afff05c](vitejs/vite@afff05c)), closes [#19001](vitejs/vite#19001)
-   fix(css): show correct error when unknown placeholder is used for CSS modules pattern in lightningcs ([9290d85](vitejs/vite@9290d85)), closes [#19070](vitejs/vite#19070)
-   fix(resolve): handle package.json with UTF-8 BOM ([#19000](vitejs/vite#19000)) ([902567a](vitejs/vite@902567a)), closes [#19000](vitejs/vite#19000)
-   fix(ssrTransform): preserve line offset when transforming imports ([#19004](vitejs/vite#19004)) ([1aa434e](vitejs/vite@1aa434e)), closes [#19004](vitejs/vite#19004)
-   chore: fix typo in comment ([#19067](vitejs/vite#19067)) ([eb06ec3](vitejs/vite@eb06ec3)), closes [#19067](vitejs/vite#19067)
-   chore: update comment about `build.target` ([#19047](vitejs/vite#19047)) ([0e9e81f](vitejs/vite@0e9e81f)), closes [#19047](vitejs/vite#19047)
-   revert: unpin esbuild version ([#19043](vitejs/vite#19043)) ([8bfe247](vitejs/vite@8bfe247)), closes [#19043](vitejs/vite#19043)
-   test(ssr): test virtual module with query ([#19044](vitejs/vite#19044)) ([a1f4b46](vitejs/vite@a1f4b46)), closes [#19044](vitejs/vite#19044)
moonlitusun pushed a commit to moonlitusun/vite that referenced this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: css p2-edge-case Bug, but has workaround or limited in scope (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants