Skip to content

Commit 6d2c68a

Browse files
authored
feat: rspack 1.0.0 (#84)
* deps: upgrade to rspack 1.0.0 * Fix proxy type
1 parent f01689b commit 6d2c68a

File tree

4 files changed

+1423
-1263
lines changed

4 files changed

+1423
-1263
lines changed

config/eslintrc.template.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ module.exports = ({ tsconfigRootDir }) => ({
99
'plugin:react/recommended',
1010
'plugin:@typescript-eslint/recommended',
1111
'plugin:prettier/recommended',
12+
'plugin:lodash/recommended',
1213
],
13-
plugins: ['react', '@typescript-eslint', 'react-compiler'],
14+
plugins: ['react', '@typescript-eslint', 'react-compiler', 'lodash'],
1415
ignorePatterns: ['*.js'],
1516
env: {
1617
browser: true,

config/rspack.config.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const dotenv = require('dotenv');
88
const { DotenvPlugin } = require('rspack-plugin-dotenv');
99
const dotenvExpand = require('dotenv-expand');
1010
const {
11-
CopyRspackPlugin, DefinePlugin, SwcJsMinimizerRspackPlugin, SwcCssMinimizerRspackPlugin,
11+
CopyRspackPlugin, DefinePlugin, SwcJsMinimizerRspackPlugin, LightningCssMinimizerRspackPlugin,
1212
} = require('@rspack/core');
1313
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
1414
const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -31,7 +31,7 @@ module.exports = (webpackEnv, argv) => {
3131
}
3232

3333
const isDevServerOnly = env.dev_server_only?.toLowerCase() === 'true';
34-
const devtool = env.devtool?.toLowerCase() === 'false' ? false : (env.devtool || (isEnvDevelopment ? 'eval-cheap-module-source-map' : 'source-map'));
34+
const devtool = env.devtool?.toLowerCase() === 'false' ? false : (env.devtool || (isEnvDevelopment ? 'eval-source-map' : 'source-map'));
3535
const isReactRefresh = isDevServer && isEnvDevelopment;
3636

3737
const now = new Date();
@@ -114,23 +114,22 @@ module.exports = (webpackEnv, argv) => {
114114
open: true,
115115
// Needs to be enabled to make SPAs work: https://stackoverflow.com/questions/31945763/how-to-tell-webpack-dev-server-to-serve-index-html-for-any-route
116116
historyApiFallback: historyApiFallback == null ? true : historyApiFallback,
117-
proxy: {
117+
proxy: [
118118
// Append on top to allow overriding /api/v1/ for example
119-
...(devServerProxy || {}),
120-
...{
121-
'/api/*': {
122-
target: 'http://localhost:9000',
123-
secure: false,
124-
ws: true,
125-
// Explicitly forward close events for properly closing SSE (server-side events). See https://github.com/webpack/webpack-dev-server/issues/2769#issuecomment-1517290190
126-
onProxyReq: (proxyReq, req, res) => {
127-
res.on('close', () => proxyReq.destroy());
128-
},
119+
...(devServerProxy || []),
120+
{
121+
context: ['/api/'],
122+
target: 'http://localhost:9000',
123+
secure: false,
124+
ws: true,
125+
// Explicitly forward close events for properly closing SSE (server-side events). See https://github.com/webpack/webpack-dev-server/issues/2769#issuecomment-1517290190
126+
onProxyReq: (proxyReq, req, res) => {
127+
res.on('close', () => proxyReq.destroy());
129128
},
130-
// Append on bottom to allow override of exact key matches like /api/*
131-
...(devServerProxy || {}),
132129
},
133-
},
130+
// Append on bottom to allow override of exact key matches like /api/*
131+
...(devServerProxy || []),
132+
],
134133
client: {
135134
// Do not show the full-page error overlay
136135
overlay: false,
@@ -182,9 +181,12 @@ module.exports = (webpackEnv, argv) => {
182181
compress: false,
183182
mangle: false,
184183
}),
185-
new SwcCssMinimizerRspackPlugin(),
184+
new LightningCssMinimizerRspackPlugin(),
186185
],
187186
},
187+
experiments: {
188+
css: true,
189+
},
188190
module: {
189191
rules: [
190192
{

package.json

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@
3333
"dist": "npm run lint && npm run test"
3434
},
3535
"dependencies": {
36-
"@rsdoctor/cli": "^0.3.10",
37-
"@rsdoctor/rspack-plugin": "^0.3.10",
38-
"@rspack/cli": "~0.7.5",
39-
"@rspack/core": "~0.7.5",
36+
"@rsdoctor/cli": "^0.3.11",
37+
"@rsdoctor/rspack-plugin": "^0.3.11",
38+
"@rspack/cli": "~1.0.0",
39+
"@rspack/core": "~1.0.0",
4040
"@rspack/plugin-minify": "~0.7.5",
41-
"@rspack/plugin-react-refresh": "~0.7.5",
42-
"@storybook/addon-actions": "^7.6.17",
43-
"@storybook/addon-essentials": "^7.6.17",
44-
"@storybook/addon-interactions": "^7.6.17",
45-
"@storybook/addon-links": "^7.6.17",
41+
"@rspack/plugin-react-refresh": "~1.0.0",
42+
"@storybook/addon-actions": "^7.6.20",
43+
"@storybook/addon-essentials": "^7.6.20",
44+
"@storybook/addon-interactions": "^7.6.20",
45+
"@storybook/addon-links": "^7.6.20",
4646
"@storybook/addon-styling": "^1.3.7",
47-
"@storybook/addon-styling-webpack": "^0.0.6",
48-
"@storybook/cli": "^7.6.17",
49-
"@storybook/react": "^7.6.17",
50-
"@storybook/react-webpack5": "^7.6.17",
47+
"@storybook/addon-styling-webpack": "^1.0.0",
48+
"@storybook/cli": "^7.6.20",
49+
"@storybook/react": "^7.6.20",
50+
"@storybook/react-webpack5": "^7.6.20",
5151
"@storybook/testing-library": "0.2.2",
52-
"@swc/core": "~1.7.2",
52+
"@swc/core": "~1.7.21",
5353
"@swc/helpers": "~0.5.12",
5454
"@swc/jest": "~0.2.36",
5555
"@types/jest": "~27.4.1",
5656
"@types/node": "^20.14.12",
57-
"@typescript-eslint/eslint-plugin": "~7.17.0",
58-
"@typescript-eslint/parser": "~7.17.0",
57+
"@typescript-eslint/eslint-plugin": "~8.3.0",
58+
"@typescript-eslint/parser": "~8.3.0",
5959
"dotenv": "^16.4.5",
6060
"dotenv-expand": "^11.0.6",
6161
"eslint": "^8.57.0",
@@ -64,14 +64,15 @@
6464
"eslint-config-airbnb-typescript": "^18.0.0",
6565
"eslint-config-prettier": "^9.1.0",
6666
"eslint-config-react-app": "^7.0.1",
67-
"eslint-plugin-chai-friendly": "^1.0.0",
68-
"eslint-plugin-cypress": "^3.4.0",
67+
"eslint-plugin-chai-friendly": "^1.0.1",
68+
"eslint-plugin-cypress": "^3.5.0",
6969
"eslint-plugin-import": "^2.29.1",
7070
"eslint-plugin-jest": "^27.9.0",
7171
"eslint-plugin-jsx-a11y": "^6.9.0",
72+
"eslint-plugin-lodash": "^8.0.0",
7273
"eslint-plugin-prettier": "^5.2.1",
7374
"eslint-plugin-react": "^7.35.0",
74-
"eslint-plugin-react-compiler": "0.0.0-experimental-9ed098e-20240725",
75+
"eslint-plugin-react-compiler": "0.0.0-experimental-0924e7a-20240827",
7576
"eslint-plugin-react-hooks": "^4.6.2",
7677
"fork-ts-checker-webpack-plugin": "^9.0.2",
7778
"fs-extra": "^11.2.0",
@@ -82,36 +83,36 @@
8283
"jest": "^27.5.1",
8384
"jest-raw-loader": "~1.0.1",
8485
"jest-resolve": "^27.4.2",
85-
"postcss": "^8.4.35",
86+
"postcss": "^8.4.41",
8687
"postcss-flexbugs-fixes": "^5.0.2",
8788
"postcss-loader": "^8.1.1",
8889
"postcss-normalize": "^10.0.1",
89-
"postcss-preset-env": "^9.6.0",
90+
"postcss-preset-env": "^10.0.2",
9091
"prettier": "^3.3.3",
9192
"react-dev-utils": "^12.0.1",
9293
"react-refresh": "^0.14.2",
9394
"resolve-url-loader": "^5.0.0",
9495
"rimraf": "~6.0.1",
9596
"rspack-plugin-dotenv": "^0.0.3",
9697
"sass-embedded": "~1.77.8",
97-
"sass-loader": "^16.0.0",
98+
"sass-loader": "^16.0.1",
9899
"shx": "~0.3.4",
99-
"storybook": "^7.6.17",
100+
"storybook": "^7.6.20",
100101
"storybook-addon-swc": "^1.2.0",
101-
"tailwindcss": "^3.4.7",
102+
"tailwindcss": "^3.4.10",
102103
"ts-node": "^10.9.2",
103-
"tslib": "~2.6.3",
104+
"tslib": "~2.7.0",
104105
"typescript": "~5.5.4",
105106
"util": "^0.12.5",
106107
"yargs": "^17.7.2"
107108
},
108109
"devDependencies": {
109-
"@types/yargs": "^17.0.32",
110+
"@types/yargs": "^17.0.33",
110111
"http-server": "^14.1.1",
111-
"jest-dev-server": "^6.1.1"
112+
"jest-dev-server": "^6.2.0"
112113
},
113114
"peerDependencies": {
114-
"@types/react": "^18.3.3",
115+
"@types/react": "^18.3.4",
115116
"@types/react-dom": "^18.3.0",
116117
"react": "^18.3.1",
117118
"react-dom": "^18.3.1"

0 commit comments

Comments
 (0)