Conversation
commit: |
There was a problem hiding this comment.
Pull request overview
This PR expands the plugin’s “CSS import externalization” handling to include common CSS preprocessor extensions (e.g., .scss, .sass, .less, .styl*), and adds a regression test to ensure SCSS imports don’t get inlined into generated declaration output.
Changes:
- Extend
RE_CSSto match additional stylesheet/preprocessor extensions. - Add a fixture and a test case covering SCSS imports being externalized.
- Update Jest snapshot to include the new SCSS test output.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/index.test.ts | Adds a new test asserting SCSS imports are externalized and not inlined. |
| tests/fixtures/css-scss/styles.scss | New SCSS fixture used by the test. |
| tests/fixtures/css-scss/index.ts | Imports the SCSS fixture to exercise the behavior under test. |
| tests/snapshots/index.test.ts.snap | Adds snapshot output for the new test. |
| src/filename.ts | Extends the stylesheet-matching regex to include preprocessors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const RE_DTS_MAP: RegExp = /\.d\.([cm]?)ts\.map$/ | ||
| export const RE_NODE_MODULES: RegExp = /[\\/]node_modules[\\/]/ | ||
| export const RE_CSS: RegExp = /\.css$/ | ||
| export const RE_CSS: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/ |
There was a problem hiding this comment.
RE_CSS now matches multiple stylesheet/preprocessor extensions (scss/sass/less/styl*), so the constant name is slightly misleading. Consider renaming it to something like RE_STYLE/RE_STYLESHEET (and updating imports/usages) to better reflect what it matches.
| export const RE_CSS: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/ | |
| export const RE_STYLESHEET: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/ | |
| export const RE_CSS: RegExp = RE_STYLESHEET |
Description
Mark
.sass,.scssfiles, etc., as externalized.Linked Issues
rolldown/tsdown#801
Additional context