Skip to content

chore: update swc-loader configuration to detect syntax automatically#421

Merged
chenjiahan merged 1 commit intomainfrom
detect_syntax_0410
Apr 10, 2026
Merged

chore: update swc-loader configuration to detect syntax automatically#421
chenjiahan merged 1 commit intomainfrom
detect_syntax_0410

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 10, 2026 02:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates multiple Rspack example configurations to rely on builtin:swc-loader’s automatic syntax detection, reducing the need to hardcode SWC parser syntax per file type.

Changes:

  • Replace explicit jsc.parser.syntax (and related JSX/TSX flags) with detectSyntax: 'auto' in many example configs.
  • Broaden SWC rule test patterns to cover additional JS/TS module extensions (e.g., mjs/cjs/mts/cts) and add exclude: /node_modules/ in several examples.
  • Simplify some configs by merging previously separate TS/TSX SWC rules into a single rule.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rspack/vue/rspack.config.js Switch SWC rule to wider extension coverage and detectSyntax: 'auto'.
rspack/vanilla-extract-css/rspack.config.js Use detectSyntax: 'auto' and adjust SWC test for more extensions.
rspack/type-reexports-presence/rspack.config.mjs Replace explicit TS parser syntax with detectSyntax: 'auto'.
rspack/ts-checker-rspack-plugin/rspack.config.js Replace explicit TS parser syntax with detectSyntax: 'auto' (plus minor quote style change).
rspack/svgr/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/svelte/rspack.config.js Replace explicit TS parser syntax with detectSyntax: 'auto'.
rspack/styled-components/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/source-map-with-vscode-debugging/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/react/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/react-with-sass/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/react-with-less/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/react-with-extract-css/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/react-ssr-esm/rspack.config.server.js Expand SWC test, add exclude, and add detectSyntax: 'auto' options.
rspack/react-ssr-esm/rspack.config.client.js Expand SWC test, add exclude, and add detectSyntax: 'auto' options.
rspack/react-refresh/rspack.config.js Replace TSX parser config with detectSyntax: 'auto' and broaden test/add exclude.
rspack/react-refresh-esm/rspack.config.js Replace TSX parser config with detectSyntax: 'auto' and broaden test/add exclude.
rspack/react-compiler-babel/rspack.config.js Replace explicit ecmascript parser config with detectSyntax: 'auto' and broaden JS test.
rspack/react-compiler-babel-ts/rspack.config.js Replace explicit TS/TSX parser config with detectSyntax: 'auto' and broaden JS/TS test.
rspack/preact/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/preact-refresh/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto' (remove explicit parser config).
rspack/polyfill/rspack.config.js Broaden SWC test and enable detectSyntax: 'auto'.
rspack/nestjs/rspack.config.js Add detectSyntax: 'auto' and remove explicit TS parser syntax while keeping decorator settings.
rspack/monaco-editor-ts-react/rspack.config.js Merge TS/TSX SWC rules into one, broaden test, add exclude, and enable detectSyntax: 'auto'.
rspack/module-federation-v1/lib2/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/module-federation-v1/lib1/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/module-federation-v1/app/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/module-federation-v1.5/lib2/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/module-federation-v1.5/lib1/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/module-federation-v1.5/app/rspack.config.js Broaden test and replace explicit parser config with detectSyntax: 'auto'.
rspack/license-webpack-plugin/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/inline-enum/rspack.config.mjs Replace explicit TS parser syntax with detectSyntax: 'auto'.
rspack/inline-const/rspack.config.mjs Add detectSyntax: 'auto' and remove explicit TS parser syntax from jsc.
rspack/inline-const-enum/rspack.config.mjs Add detectSyntax: 'auto' and remove explicit TS parser syntax from jsc.
rspack/express/rspack.config.js Add detectSyntax: 'auto' and remove explicit TS parser syntax while keeping decorator settings.
rspack/emotion/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/cra/rspack.config.js Broaden SWC test, add exclude, and enable detectSyntax: 'auto'.
rspack/cra-ts/rspack.config.js Broaden SWC test, add exclude, enable detectSyntax: 'auto', and remove redundant TS-only rule.
rspack/builtin-swc-loader/rspack.config.mjs Broaden SWC test and enable detectSyntax: 'auto'.
rspack/basic-ts/rspack.config.mjs Broaden SWC test and replace explicit TS parser syntax with detectSyntax: 'auto'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 9dd1c7e into main Apr 10, 2026
8 checks passed
@chenjiahan chenjiahan deleted the detect_syntax_0410 branch April 10, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants