Title: CSS modules transform produces invalid output with certain class names · Issue #31 · unplugin/unplugin-lightningcss · GitHub
Open Graph Title: CSS modules transform produces invalid output with certain class names · Issue #31 · unplugin/unplugin-lightningcss
X Title: CSS modules transform produces invalid output with certain class names · Issue #31 · unplugin/unplugin-lightningcss
Description: Describe the bug The recent PR #22 added css-modules support, but the code exporting classnames is missing the fact that class names are not a good fit for JS variables: https://github.com/nicksrandall/unplugin-lightningcss/blob/01f1d485...
Open Graph Description: Describe the bug The recent PR #22 added css-modules support, but the code exporting classnames is missing the fact that class names are not a good fit for JS variables: https://github.com/nicksran...
X Description: Describe the bug The recent PR #22 added css-modules support, but the code exporting classnames is missing the fact that class names are not a good fit for JS variables: https://github.com/nicksran...
Opengraph URL: https://github.com/unplugin/unplugin-lightningcss/issues/31
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CSS modules transform produces invalid output with certain class names","articleBody":"### Describe the bug\n\nThe recent PR #22 added css-modules support, but the code exporting classnames is missing the fact that class names are not a good fit for JS variables:\n\nhttps://github.com/nicksrandall/unplugin-lightningcss/blob/01f1d485ab119d213b955b69ac3c5065d83875e9/src/core/transform.ts#L49-L54\n\n\nThis causes CSS such like:\n\n```css\n.my-class {...}\n```\n\nTo fail build due to the error like so:\n```\n\n 2 │ export const my-class = \"G6CPCq_my-class\";\n │ │ \n │ ╰─ \n │ \n │ Help: Try insert a semicolon here\n```\n\n### Reproduction\n\nSee above\n\n### System Info\n\n```Shell\nAny system\n```\n\n### Used Package Manager\n\nnpm\n\n### Validations\n\n- [x] Follow our [Code of Conduct](https://github.com/antfu/.github/blob/main/CODE_OF_CONDUCT.md)\n- [x] Read the [Contributing Guide](https://github.com/antfu/contribute).\n- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.\n- [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.\n- [x] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.","author":{"url":"https://github.com/OEvgeny","@type":"Person","name":"OEvgeny"},"datePublished":"2025-05-21T00:20:33Z","url":"https://github.com/unplugin/unplugin-lightningcss/issues/31"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bc798fcb-93b4-544d-3b0d-c79da1bc5a7e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D172:210CB4:4013EA:59FBF9:6B00717A |
| html-safe-nonce | 7201fa2bb08d7ec34c034da08801f1e83b32883ff8d0af6f158fdb63a07ea7f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTcyOjIxMENCNDo0MDEzRUE6NTlGQkY5OjZCMDA3MTdBIiwidmlzaXRvcl9pZCI6IjQ4NjE4MzAxNTQzNzg1NzE0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | abe642704365c3205ee4da150b8bedf34d33f792466c82bcb420b9a037462ec6 |
| hovercard-subject-tag | issue:3078510763 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unplugin/unplugin-lightningcss/31/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cba7d074424a08140a441cdfc8538496002eef19b9ce493dc7012a9cabf9b2bc/unplugin/unplugin-lightningcss/issues/31 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cba7d074424a08140a441cdfc8538496002eef19b9ce493dc7012a9cabf9b2bc/unplugin/unplugin-lightningcss/issues/31 |
| og:image:alt | Describe the bug The recent PR #22 added css-modules support, but the code exporting classnames is missing the fact that class names are not a good fit for JS variables: https://github.com/nicksran... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OEvgeny |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| turbo-cache-control | no-preview |
| go-import | github.com/unplugin/unplugin-lightningcss git https://github.com/unplugin/unplugin-lightningcss.git |
| octolytics-dimension-user_id | 143585159 |
| octolytics-dimension-user_login | unplugin |
| octolytics-dimension-repository_id | 677769344 |
| octolytics-dimension-repository_nwo | unplugin/unplugin-lightningcss |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 677769344 |
| octolytics-dimension-repository_network_root_nwo | unplugin/unplugin-lightningcss |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width