From 26a2636421e54401ddbfc0f4dbfb786200c8e818 Mon Sep 17 00:00:00 2001 From: gaoyuan Date: Mon, 1 Jul 2024 18:56:01 +0800 Subject: [PATCH] fix: adapt rspack 1.0.0-alpha (#94) --- rsdoctor/arco-pro/rspack.config.js | 3 +++ rspack/basic-ts/rspack.config.js | 4 +++- rspack/builtin-swc-loader/rspack.config.js | 3 +++ rspack/cra-ts/rspack.config.js | 3 +++ rspack/cra/rspack.config.js | 3 +++ rspack/loader-compat/rspack.config.js | 3 +++ rspack/postcss-loader/rspack.config.js | 3 +++ rspack/preact/rspack.config.js | 3 +++ rspack/react-15-classic/rspack.config.js | 3 +++ rspack/react-15/rspack.config.js | 3 +++ rspack/react-compiler-babel/rspack.config.js | 3 +++ rspack/react-storybook/rspack.config.js | 3 +++ rspack/react-with-less/rspack.config.js | 3 +++ rspack/react-with-sass/rspack.config.js | 3 +++ rspack/react/rspack.config.js | 3 +++ rspack/solid/rspack.config.js | 3 +++ rspack/svelte/rspack.config.js | 3 +++ rspack/tailwind-jit/rspack.config.js | 3 +++ rspack/tailwind/rspack.config.js | 3 +++ rspack/treeshaking-transform-imports/rspack.config.js | 3 +++ rspack/vanilla-extract-css/rspack.config.js | 3 +++ rspack/vue/rspack.config.js | 3 +++ rspack/vue2/rspack.config.js | 3 +++ rspack/vue3-jsx/rspack.config.js | 3 +++ rspack/vue3-tsx/rspack.config.js | 3 +++ 25 files changed, 75 insertions(+), 1 deletion(-) diff --git a/rsdoctor/arco-pro/rspack.config.js b/rsdoctor/arco-pro/rspack.config.js index ef7fa8e7..685e139a 100644 --- a/rsdoctor/arco-pro/rspack.config.js +++ b/rsdoctor/arco-pro/rspack.config.js @@ -17,6 +17,9 @@ const config = { webSocketServer: 'sockjs', historyApiFallback: true, }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/basic-ts/rspack.config.js b/rspack/basic-ts/rspack.config.js index ef120f8b..2ffa0092 100644 --- a/rspack/basic-ts/rspack.config.js +++ b/rspack/basic-ts/rspack.config.js @@ -5,7 +5,9 @@ const rspack = require('@rspack/core'); const config = { entry: './src/index.ts', resolve: { - tsConfigPath: path.resolve(__dirname, 'tsconfig.json'), + tsConfig: { + configFile: path.resolve(__dirname, 'tsconfig.json'), + }, extensions: ['...', '.ts'], }, plugins: [ diff --git a/rspack/builtin-swc-loader/rspack.config.js b/rspack/builtin-swc-loader/rspack.config.js index 9688597e..1f05d0ee 100644 --- a/rspack/builtin-swc-loader/rspack.config.js +++ b/rspack/builtin-swc-loader/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.jsx'], alias: { diff --git a/rspack/cra-ts/rspack.config.js b/rspack/cra-ts/rspack.config.js index 38563f7a..f82e325b 100644 --- a/rspack/cra-ts/rspack.config.js +++ b/rspack/cra-ts/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.tsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/cra/rspack.config.js b/rspack/cra/rspack.config.js index 3e10f438..780bd5f0 100644 --- a/rspack/cra/rspack.config.js +++ b/rspack/cra/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/loader-compat/rspack.config.js b/rspack/loader-compat/rspack.config.js index ade1481a..c3f001be 100644 --- a/rspack/loader-compat/rspack.config.js +++ b/rspack/loader-compat/rspack.config.js @@ -9,6 +9,9 @@ const config = { resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/postcss-loader/rspack.config.js b/rspack/postcss-loader/rspack.config.js index ee771ef9..7e4288b6 100644 --- a/rspack/postcss-loader/rspack.config.js +++ b/rspack/postcss-loader/rspack.config.js @@ -6,6 +6,9 @@ const config = { entry: { main: './src/index.js', }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/preact/rspack.config.js b/rspack/preact/rspack.config.js index f0a35356..f7cd897a 100644 --- a/rspack/preact/rspack.config.js +++ b/rspack/preact/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], alias: { diff --git a/rspack/react-15-classic/rspack.config.js b/rspack/react-15-classic/rspack.config.js index 2e34fbb3..0386194f 100644 --- a/rspack/react-15-classic/rspack.config.js +++ b/rspack/react-15-classic/rspack.config.js @@ -4,6 +4,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/react-15/rspack.config.js b/rspack/react-15/rspack.config.js index 4ef7bba3..f310175f 100644 --- a/rspack/react-15/rspack.config.js +++ b/rspack/react-15/rspack.config.js @@ -4,6 +4,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/react-compiler-babel/rspack.config.js b/rspack/react-compiler-babel/rspack.config.js index 1aaec1a6..45c672bf 100644 --- a/rspack/react-compiler-babel/rspack.config.js +++ b/rspack/react-compiler-babel/rspack.config.js @@ -4,6 +4,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.jsx'], }, diff --git a/rspack/react-storybook/rspack.config.js b/rspack/react-storybook/rspack.config.js index 7b458f00..ef3a136f 100644 --- a/rspack/react-storybook/rspack.config.js +++ b/rspack/react-storybook/rspack.config.js @@ -8,6 +8,9 @@ module.exports = { entry: { main: './src/main.jsx', }, + experiments: { + css: true, + }, plugins: [ new rspack.HtmlRspackPlugin({ template: './index.html', diff --git a/rspack/react-with-less/rspack.config.js b/rspack/react-with-less/rspack.config.js index 3b81bcbd..a5fa1662 100644 --- a/rspack/react-with-less/rspack.config.js +++ b/rspack/react-with-less/rspack.config.js @@ -7,6 +7,9 @@ const config = { entry: { main: ['./src/index.jsx'], }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/react-with-sass/rspack.config.js b/rspack/react-with-sass/rspack.config.js index d08df092..700cba98 100644 --- a/rspack/react-with-sass/rspack.config.js +++ b/rspack/react-with-sass/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: ['./src/index.jsx'], }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/react/rspack.config.js b/rspack/react/rspack.config.js index 8b227d24..9993965e 100644 --- a/rspack/react/rspack.config.js +++ b/rspack/react/rspack.config.js @@ -7,6 +7,9 @@ const config = { resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/solid/rspack.config.js b/rspack/solid/rspack.config.js index b7eea434..789ec0f5 100644 --- a/rspack/solid/rspack.config.js +++ b/rspack/solid/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.jsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, diff --git a/rspack/svelte/rspack.config.js b/rspack/svelte/rspack.config.js index f9beb18c..c1293f42 100644 --- a/rspack/svelte/rspack.config.js +++ b/rspack/svelte/rspack.config.js @@ -16,6 +16,9 @@ const config = { extensions: ['.mjs', '.js', '.ts', '.svelte'], mainFields: ['svelte', 'browser', 'module', 'main'], }, + experiments: { + css: true, + }, output: { path: path.join(__dirname, '/dist'), filename: '[name].js', diff --git a/rspack/tailwind-jit/rspack.config.js b/rspack/tailwind-jit/rspack.config.js index 1e5be432..dac2448b 100644 --- a/rspack/tailwind-jit/rspack.config.js +++ b/rspack/tailwind-jit/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.js', }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/tailwind/rspack.config.js b/rspack/tailwind/rspack.config.js index 61792d33..cb47a626 100644 --- a/rspack/tailwind/rspack.config.js +++ b/rspack/tailwind/rspack.config.js @@ -7,6 +7,9 @@ module.exports = { entry: { main: './src/index.js', }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/treeshaking-transform-imports/rspack.config.js b/rspack/treeshaking-transform-imports/rspack.config.js index 081d3753..500d84b3 100644 --- a/rspack/treeshaking-transform-imports/rspack.config.js +++ b/rspack/treeshaking-transform-imports/rspack.config.js @@ -5,6 +5,9 @@ const config = { entry: { main: './src/index.js', }, + experiments: { + css: true, + }, plugins: [new rspack.HtmlRspackPlugin()], optimization: { minimize: false, diff --git a/rspack/vanilla-extract-css/rspack.config.js b/rspack/vanilla-extract-css/rspack.config.js index 65af0d9f..b05df0b8 100644 --- a/rspack/vanilla-extract-css/rspack.config.js +++ b/rspack/vanilla-extract-css/rspack.config.js @@ -11,6 +11,9 @@ module.exports = { extensions: ['.js', '.json', '.ts', '.tsx'], }, devtool: 'source-map', + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/vue/rspack.config.js b/rspack/vue/rspack.config.js index 47afa13f..ad23bc77 100644 --- a/rspack/vue/rspack.config.js +++ b/rspack/vue/rspack.config.js @@ -7,6 +7,9 @@ const config = { entry: { main: './src/main.js', }, + experiments: { + css: true, + }, devServer: { historyApiFallback: true, }, diff --git a/rspack/vue2/rspack.config.js b/rspack/vue2/rspack.config.js index f675812c..ebf66646 100644 --- a/rspack/vue2/rspack.config.js +++ b/rspack/vue2/rspack.config.js @@ -7,6 +7,9 @@ const config = { entry: { main: './src/main.js', }, + experiments: { + css: true, + }, devServer: { historyApiFallback: true, }, diff --git a/rspack/vue3-jsx/rspack.config.js b/rspack/vue3-jsx/rspack.config.js index 0e324484..bd341c6c 100644 --- a/rspack/vue3-jsx/rspack.config.js +++ b/rspack/vue3-jsx/rspack.config.js @@ -8,6 +8,9 @@ const config = { resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, + experiments: { + css: true, + }, module: { rules: [ { diff --git a/rspack/vue3-tsx/rspack.config.js b/rspack/vue3-tsx/rspack.config.js index c7c7c9cf..ca138c4c 100644 --- a/rspack/vue3-tsx/rspack.config.js +++ b/rspack/vue3-tsx/rspack.config.js @@ -7,6 +7,9 @@ const config = { entry: { main: './src/main.tsx', }, + experiments: { + css: true, + }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], },