diff --git a/rspack/basic-ts/rspack.config.mjs b/rspack/basic-ts/rspack.config.mjs index e41c43b7..8403c1e4 100644 --- a/rspack/basic-ts/rspack.config.mjs +++ b/rspack/basic-ts/rspack.config.mjs @@ -22,7 +22,7 @@ export default defineConfig({ module: { rules: [ { - test: /\.(?:js|ts)$/, + test: /\.(?:js|mjs|cjs|ts|mts|cts)$/, use: [ { loader: 'builtin:swc-loader', @@ -30,11 +30,7 @@ export default defineConfig({ * @type {import('@rspack/core').SwcLoaderOptions} */ options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', }, }, ], diff --git a/rspack/builtin-swc-loader/rspack.config.mjs b/rspack/builtin-swc-loader/rspack.config.mjs index e41d3d2f..ac05e6ab 100644 --- a/rspack/builtin-swc-loader/rspack.config.mjs +++ b/rspack/builtin-swc-loader/rspack.config.mjs @@ -27,18 +27,15 @@ export default defineConfig({ type: 'css', }, { - test: /\.(jsx|js)$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, use: { loader: 'builtin:swc-loader', /** * @type {import('@rspack/core').SwcLoaderOptions} */ options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/cra-ts/rspack.config.js b/rspack/cra-ts/rspack.config.js index 74cfc641..b5e7553a 100644 --- a/rspack/cra-ts/rspack.config.js +++ b/rspack/cra-ts/rspack.config.js @@ -15,15 +15,13 @@ const config = { type: 'css', }, { - test: /\.tsx$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { @@ -38,22 +36,6 @@ const config = { }, type: 'javascript/auto', }, - { - test: /\.ts$/, - use: { - loader: 'builtin:swc-loader', - options: { - jsc: { - parser: { - syntax: 'typescript', - }, - externalHelpers: true, - preserveAllComments: false, - }, - }, - }, - type: 'javascript/auto', - }, { test: /\.svg$/, type: 'asset/resource', diff --git a/rspack/cra/rspack.config.js b/rspack/cra/rspack.config.js index 4de479bc..fb3085a8 100644 --- a/rspack/cra/rspack.config.js +++ b/rspack/cra/rspack.config.js @@ -16,15 +16,13 @@ const config = { type: 'css', }, { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/emotion/rspack.config.js b/rspack/emotion/rspack.config.js index f3547bf2..f2fa629d 100644 --- a/rspack/emotion/rspack.config.js +++ b/rspack/emotion/rspack.config.js @@ -15,14 +15,12 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { importSource: '@emotion/react', diff --git a/rspack/express/rspack.config.js b/rspack/express/rspack.config.js index 4a334e7e..984490fc 100644 --- a/rspack/express/rspack.config.js +++ b/rspack/express/rspack.config.js @@ -17,9 +17,9 @@ const config = { use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { parser: { - syntax: 'typescript', decorators: true, }, }, diff --git a/rspack/inline-const-enum/rspack.config.mjs b/rspack/inline-const-enum/rspack.config.mjs index a813e073..a71343b0 100644 --- a/rspack/inline-const-enum/rspack.config.mjs +++ b/rspack/inline-const-enum/rspack.config.mjs @@ -23,10 +23,8 @@ export default { loader: 'builtin:swc-loader', /** @type {import("@rspack/core").SwcLoaderOptions} */ options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - }, transform: { tsEnumIsMutable: true, }, diff --git a/rspack/inline-const/rspack.config.mjs b/rspack/inline-const/rspack.config.mjs index df6f5b94..fd209f6b 100644 --- a/rspack/inline-const/rspack.config.mjs +++ b/rspack/inline-const/rspack.config.mjs @@ -29,10 +29,8 @@ export default { loader: 'builtin:swc-loader', /** @type {import("@rspack/core").SwcLoaderOptions} */ options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - }, target: 'es2015', // use target es2015 or greater so swc won't transform const to var }, }, diff --git a/rspack/inline-enum/rspack.config.mjs b/rspack/inline-enum/rspack.config.mjs index c9a4bbe0..bf849980 100644 --- a/rspack/inline-enum/rspack.config.mjs +++ b/rspack/inline-enum/rspack.config.mjs @@ -23,11 +23,7 @@ export default { loader: 'builtin:swc-loader', /** @type {import("@rspack/core").SwcLoaderOptions} */ options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', collectTypeScriptInfo: { exportedEnum: true, }, diff --git a/rspack/license-webpack-plugin/rspack.config.js b/rspack/license-webpack-plugin/rspack.config.js index a7215890..8ddf7041 100644 --- a/rspack/license-webpack-plugin/rspack.config.js +++ b/rspack/license-webpack-plugin/rspack.config.js @@ -18,15 +18,13 @@ module.exports = defineConfig({ module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/module-federation-v1.5/app/rspack.config.js b/rspack/module-federation-v1.5/app/rspack.config.js index 020b422a..2e83696c 100644 --- a/rspack/module-federation-v1.5/app/rspack.config.js +++ b/rspack/module-federation-v1.5/app/rspack.config.js @@ -16,16 +16,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/module-federation-v1.5/lib1/rspack.config.js b/rspack/module-federation-v1.5/lib1/rspack.config.js index 1510335b..2fc4e82a 100644 --- a/rspack/module-federation-v1.5/lib1/rspack.config.js +++ b/rspack/module-federation-v1.5/lib1/rspack.config.js @@ -16,16 +16,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/module-federation-v1.5/lib2/rspack.config.js b/rspack/module-federation-v1.5/lib2/rspack.config.js index 3da8595d..52c5d741 100644 --- a/rspack/module-federation-v1.5/lib2/rspack.config.js +++ b/rspack/module-federation-v1.5/lib2/rspack.config.js @@ -15,16 +15,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/module-federation-v1/app/rspack.config.js b/rspack/module-federation-v1/app/rspack.config.js index 502362c5..fe2ede8f 100644 --- a/rspack/module-federation-v1/app/rspack.config.js +++ b/rspack/module-federation-v1/app/rspack.config.js @@ -16,16 +16,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/module-federation-v1/lib1/rspack.config.js b/rspack/module-federation-v1/lib1/rspack.config.js index 28638145..cacf7afd 100644 --- a/rspack/module-federation-v1/lib1/rspack.config.js +++ b/rspack/module-federation-v1/lib1/rspack.config.js @@ -16,16 +16,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/module-federation-v1/lib2/rspack.config.js b/rspack/module-federation-v1/lib2/rspack.config.js index 9d22bf62..7175b077 100644 --- a/rspack/module-federation-v1/lib2/rspack.config.js +++ b/rspack/module-federation-v1/lib2/rspack.config.js @@ -15,16 +15,13 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs|jsx)$/, include: path.resolve(__dirname, 'src'), use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/monaco-editor-ts-react/rspack.config.js b/rspack/monaco-editor-ts-react/rspack.config.js index 722e5fb0..632a1e6b 100644 --- a/rspack/monaco-editor-ts-react/rspack.config.js +++ b/rspack/monaco-editor-ts-react/rspack.config.js @@ -28,15 +28,13 @@ module.exports = { type: 'asset/resource', }, { - test: /\.tsx$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { @@ -51,22 +49,6 @@ module.exports = { }, type: 'javascript/auto', }, - { - test: /\.ts$/, - use: { - loader: 'builtin:swc-loader', - options: { - jsc: { - parser: { - syntax: 'typescript', - }, - externalHelpers: true, - preserveAllComments: false, - }, - }, - }, - type: 'javascript/auto', - }, ], }, plugins: [ diff --git a/rspack/nestjs/rspack.config.js b/rspack/nestjs/rspack.config.js index c6132759..b99e18b4 100644 --- a/rspack/nestjs/rspack.config.js +++ b/rspack/nestjs/rspack.config.js @@ -18,9 +18,9 @@ const config = { use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { parser: { - syntax: 'typescript', decorators: true, }, transform: { diff --git a/rspack/polyfill/rspack.config.js b/rspack/polyfill/rspack.config.js index 5962b1fc..f560ea4e 100644 --- a/rspack/polyfill/rspack.config.js +++ b/rspack/polyfill/rspack.config.js @@ -14,10 +14,11 @@ const config = { module: { rules: [ { - test: /\.js$/, + test: /\.(?:js|mjs|cjs)$/, exclude: /node_modules/, loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', env: { targets: ['> 0.01%', 'not dead', 'not op_mini all'], mode: 'usage', diff --git a/rspack/preact-refresh/rspack.config.js b/rspack/preact-refresh/rspack.config.js index 6e1a2aaf..27728f57 100644 --- a/rspack/preact-refresh/rspack.config.js +++ b/rspack/preact-refresh/rspack.config.js @@ -22,10 +22,12 @@ const config = { type: 'css', }, { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { experimental: { plugins: [ @@ -35,10 +37,6 @@ const config = { ], ], }, - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/preact/rspack.config.js b/rspack/preact/rspack.config.js index f91bc5d8..e9c78060 100644 --- a/rspack/preact/rspack.config.js +++ b/rspack/preact/rspack.config.js @@ -21,15 +21,13 @@ const config = { type: 'css', }, { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/react-compiler-babel-ts/rspack.config.js b/rspack/react-compiler-babel-ts/rspack.config.js index cf2107ab..4b441a6c 100644 --- a/rspack/react-compiler-babel-ts/rspack.config.js +++ b/rspack/react-compiler-babel-ts/rspack.config.js @@ -14,16 +14,14 @@ const config = { type: 'css', }, { - test: /\.(js|ts)$/, + test: /\.(?:js|mjs|cjs|ts|mts|cts)$/, exclude: [/[\\/]node_modules[\\/]/], use: [ { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - }, externalHelpers: true, }, }, @@ -31,16 +29,13 @@ const config = { ], }, { - test: /\.(jsx|tsx)$/, + test: /\.(?:jsx|tsx)$/, use: [ { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - tsx: true, - }, externalHelpers: true, transform: { react: { diff --git a/rspack/react-compiler-babel/rspack.config.js b/rspack/react-compiler-babel/rspack.config.js index 40a1cdfd..638dd538 100644 --- a/rspack/react-compiler-babel/rspack.config.js +++ b/rspack/react-compiler-babel/rspack.config.js @@ -14,16 +14,14 @@ const config = { type: 'css', }, { - test: /\.js$/, + test: /\.(?:js|mjs|cjs)$/, exclude: [/[\\/]node_modules[\\/]/], use: [ { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - }, externalHelpers: true, }, }, @@ -36,11 +34,8 @@ const config = { { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, transform: { react: { diff --git a/rspack/react-refresh-esm/rspack.config.js b/rspack/react-refresh-esm/rspack.config.js index 8e579c08..703e776d 100644 --- a/rspack/react-refresh-esm/rspack.config.js +++ b/rspack/react-refresh-esm/rspack.config.js @@ -23,15 +23,13 @@ const config = { type: 'css', }, { - test: /\.tsx$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - tsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/react-refresh/rspack.config.js b/rspack/react-refresh/rspack.config.js index bea0a416..97fed3cb 100644 --- a/rspack/react-refresh/rspack.config.js +++ b/rspack/react-refresh/rspack.config.js @@ -17,15 +17,13 @@ const config = { type: 'css', }, { - test: /\.tsx$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - tsx: true, - }, transform: { react: { runtime: 'automatic', diff --git a/rspack/react-ssr-esm/rspack.config.client.js b/rspack/react-ssr-esm/rspack.config.client.js index 25b451df..ff6494cb 100644 --- a/rspack/react-ssr-esm/rspack.config.client.js +++ b/rspack/react-ssr-esm/rspack.config.client.js @@ -24,8 +24,12 @@ export default { module: { rules: [ { - test: /\.tsx?$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, loader: 'builtin:swc-loader', + options: { + detectSyntax: 'auto', + }, }, ], }, diff --git a/rspack/react-ssr-esm/rspack.config.server.js b/rspack/react-ssr-esm/rspack.config.server.js index a76c0904..7850c55f 100644 --- a/rspack/react-ssr-esm/rspack.config.server.js +++ b/rspack/react-ssr-esm/rspack.config.server.js @@ -24,8 +24,12 @@ export default { module: { rules: [ { - test: /\.tsx?$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, loader: 'builtin:swc-loader', + options: { + detectSyntax: 'auto', + }, }, ], }, diff --git a/rspack/react-with-extract-css/rspack.config.js b/rspack/react-with-extract-css/rspack.config.js index e29ad1a4..62b94d6f 100644 --- a/rspack/react-with-extract-css/rspack.config.js +++ b/rspack/react-with-extract-css/rspack.config.js @@ -13,15 +13,13 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/react-with-less/rspack.config.js b/rspack/react-with-less/rspack.config.js index b6fff43d..6138a08c 100644 --- a/rspack/react-with-less/rspack.config.js +++ b/rspack/react-with-less/rspack.config.js @@ -12,15 +12,13 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/react-with-sass/rspack.config.js b/rspack/react-with-sass/rspack.config.js index 11e78399..15251f63 100644 --- a/rspack/react-with-sass/rspack.config.js +++ b/rspack/react-with-sass/rspack.config.js @@ -10,15 +10,13 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/react/rspack.config.js b/rspack/react/rspack.config.js index fd15a880..d20a5e26 100644 --- a/rspack/react/rspack.config.js +++ b/rspack/react/rspack.config.js @@ -14,15 +14,13 @@ const config = { type: 'css', }, { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/source-map-with-vscode-debugging/rspack.config.js b/rspack/source-map-with-vscode-debugging/rspack.config.js index 3cc97b7c..eebba0a1 100644 --- a/rspack/source-map-with-vscode-debugging/rspack.config.js +++ b/rspack/source-map-with-vscode-debugging/rspack.config.js @@ -15,15 +15,13 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/styled-components/rspack.config.js b/rspack/styled-components/rspack.config.js index d62edb6d..da760fe5 100644 --- a/rspack/styled-components/rspack.config.js +++ b/rspack/styled-components/rspack.config.js @@ -10,15 +10,13 @@ const config = { module: { rules: [ { - test: /\.tsx$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/svelte/rspack.config.js b/rspack/svelte/rspack.config.js index 5b8a39e8..d9e6c560 100644 --- a/rspack/svelte/rspack.config.js +++ b/rspack/svelte/rspack.config.js @@ -13,11 +13,7 @@ const swcLoaderConfig = { * @type {import('@rspack/core').SwcLoaderOptions} */ options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', }, }; diff --git a/rspack/svgr/rspack.config.js b/rspack/svgr/rspack.config.js index 24a294d6..d638ddbb 100644 --- a/rspack/svgr/rspack.config.js +++ b/rspack/svgr/rspack.config.js @@ -10,15 +10,13 @@ const config = { module: { rules: [ { - test: /\.jsx$/, + test: /\.(?:js|mjs|cjs|jsx)$/, + exclude: /node_modules/, use: { loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'ecmascript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/ts-checker-rspack-plugin/rspack.config.js b/rspack/ts-checker-rspack-plugin/rspack.config.js index 62a04744..3d882742 100644 --- a/rspack/ts-checker-rspack-plugin/rspack.config.js +++ b/rspack/ts-checker-rspack-plugin/rspack.config.js @@ -2,7 +2,7 @@ const { defineConfig } = require('@rspack/cli'); const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin'); module.exports = defineConfig({ - entry: "./src/index.ts", + entry: './src/index.ts', plugins: [new TsCheckerRspackPlugin()], module: { rules: [ @@ -12,11 +12,7 @@ module.exports = defineConfig({ { loader: 'builtin:swc-loader', options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', }, }, ], diff --git a/rspack/type-reexports-presence/rspack.config.mjs b/rspack/type-reexports-presence/rspack.config.mjs index 7f66440e..5787d63e 100644 --- a/rspack/type-reexports-presence/rspack.config.mjs +++ b/rspack/type-reexports-presence/rspack.config.mjs @@ -26,11 +26,7 @@ export default { loader: 'builtin:swc-loader', /** @type {import("@rspack/core").SwcLoaderOptions} */ options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', collectTypeScriptInfo: { typeExports: true, }, diff --git a/rspack/vanilla-extract-css/rspack.config.js b/rspack/vanilla-extract-css/rspack.config.js index eb21d472..72fb30a0 100644 --- a/rspack/vanilla-extract-css/rspack.config.js +++ b/rspack/vanilla-extract-css/rspack.config.js @@ -12,15 +12,12 @@ module.exports = { module: { rules: [ { - test: /\.(js|jsx|ts|tsx)$/, + test: /\.(?:js|mjs|jsx|ts|tsx)$/, exclude: [/node_modules/], loader: 'builtin:swc-loader', options: { + detectSyntax: 'auto', jsc: { - parser: { - syntax: 'typescript', - jsx: true, - }, externalHelpers: true, preserveAllComments: false, transform: { diff --git a/rspack/vue/rspack.config.js b/rspack/vue/rspack.config.js index f5533564..acb1950a 100644 --- a/rspack/vue/rspack.config.js +++ b/rspack/vue/rspack.config.js @@ -30,14 +30,10 @@ const config = { }, }, { - test: /\.ts$/, + test: /\.(?:js|mjs|cjs|ts|mts|cts)$/, loader: 'builtin:swc-loader', options: { - jsc: { - parser: { - syntax: 'typescript', - }, - }, + detectSyntax: 'auto', }, type: 'javascript/auto', },