Merge pull request #59 from dragooncjw/chore/demo-rsbuild

chore: demo migrate rspack to rsbuild
This commit is contained in:
chenjiawei.inizio 2025-03-18 16:58:26 +08:00 committed by GitHub
commit 42b17c1fc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 292 additions and 1869 deletions

View File

@ -19,10 +19,10 @@
"build:fast": "exit 0", "build:fast": "exit 0",
"build:watch": "exit 0", "build:watch": "exit 0",
"clean": "rimraf dist", "clean": "rimraf dist",
"dev": "MODE=app NODE_ENV=development rspack serve", "dev": "MODE=app NODE_ENV=development rsbuild dev --open",
"lint": "eslint ./src --cache", "lint": "eslint ./src --cache",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"start": "NODE_ENV=development rspack serve", "start": "NODE_ENV=development rsbuild dev --open",
"test": "exit", "test": "exit",
"test:cov": "exit", "test:cov": "exit",
"watch": "exit 0" "watch": "exit 0"
@ -40,14 +40,12 @@
"react-dom": "^18" "react-dom": "^18"
}, },
"devDependencies": { "devDependencies": {
"@rspack/cli": "0.2.1", "@rsbuild/core": "^1.2.16",
"@rsbuild/plugin-react": "^1.1.1",
"@types/node": "^18", "@types/node": "^18",
"@types/react": "^18", "@types/react": "^18",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"@typescript-eslint/parser": "^6.10.0", "eslint": "^8.54.0"
"eslint": "^8.54.0",
"less": "^4.1.2",
"less-loader": "^6"
}, },
"publishConfig": { "publishConfig": {
"access": "public", "access": "public",

View File

@ -0,0 +1,14 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
plugins: [pluginReact()],
source: {
entry: {
index: './src/app.tsx',
},
},
html: {
title: 'demo-fixed-layout-simple',
},
});

View File

@ -1,64 +0,0 @@
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
resolve: {
alias: {
react: require.resolve('react'),
'react-dom': require.resolve('react-dom'),
},
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
{
test: /\.(less|css)$/,
use: [
{
loader: 'less-loader',
options: {
// ...
},
},
],
type: 'css',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};

View File

@ -19,10 +19,10 @@
"build:fast": "exit 0", "build:fast": "exit 0",
"build:watch": "exit 0", "build:watch": "exit 0",
"clean": "rimraf dist", "clean": "rimraf dist",
"dev": "MODE=app NODE_ENV=development rspack serve", "dev": "MODE=app NODE_ENV=development rsbuild dev --open",
"lint": "eslint ./src --cache", "lint": "eslint ./src --cache",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"start": "NODE_ENV=development rspack serve", "start": "NODE_ENV=development rsbuild dev --open",
"test": "exit", "test": "exit",
"test:cov": "exit", "test:cov": "exit",
"watch": "exit 0" "watch": "exit 0"
@ -43,7 +43,8 @@
"devDependencies": { "devDependencies": {
"@flowgram.ai/ts-config": "workspace:*", "@flowgram.ai/ts-config": "workspace:*",
"@flowgram.ai/eslint-config": "workspace:*", "@flowgram.ai/eslint-config": "workspace:*",
"@rspack/cli": "0.2.1", "@rsbuild/core": "^1.2.16",
"@rsbuild/plugin-react": "^1.1.1",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^18", "@types/node": "^18",
"@types/react": "^18", "@types/react": "^18",

View File

@ -0,0 +1,14 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
plugins: [pluginReact()],
source: {
entry: {
index: './src/app.tsx',
},
},
html: {
title: 'demo-fixed-layout',
},
});

View File

@ -1,64 +0,0 @@
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
resolve: {
alias: {
react: require.resolve('react'),
'react-dom': require.resolve('react-dom'),
},
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
{
test: /\.(less|css)$/,
use: [
{
loader: 'less-loader',
options: {
// ...
},
},
],
type: 'css',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};

View File

@ -19,10 +19,10 @@
"build:fast": "exit 0", "build:fast": "exit 0",
"build:watch": "exit 0", "build:watch": "exit 0",
"clean": "rimraf dist", "clean": "rimraf dist",
"dev": "MODE=app NODE_ENV=development rspack serve", "dev": "MODE=app NODE_ENV=development rsbuild dev --open",
"lint": "eslint ./src --cache", "lint": "eslint ./src --cache",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"start": "NODE_ENV=development rspack serve", "start": "NODE_ENV=development rsbuild dev --open",
"test": "exit", "test": "exit",
"test:cov": "exit", "test:cov": "exit",
"watch": "exit 0" "watch": "exit 0"
@ -37,13 +37,13 @@
"devDependencies": { "devDependencies": {
"@flowgram.ai/ts-config": "workspace:*", "@flowgram.ai/ts-config": "workspace:*",
"@flowgram.ai/eslint-config": "workspace:*", "@flowgram.ai/eslint-config": "workspace:*",
"@rspack/cli": "0.2.1", "@rsbuild/core": "^1.2.16",
"@rsbuild/plugin-react": "^1.1.1",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^18", "@types/node": "^18",
"@types/react": "^18", "@types/react": "^18",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"@types/styled-components": "^5", "@types/styled-components": "^5",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.54.0" "eslint": "^8.54.0"
}, },
"publishConfig": { "publishConfig": {

View File

@ -0,0 +1,14 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
plugins: [pluginReact()],
source: {
entry: {
index: './src/app.tsx',
},
},
html: {
title: 'demo-free-layout-simple',
},
});

View File

@ -1,46 +0,0 @@
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};

View File

@ -19,10 +19,10 @@
"build:fast": "exit 0", "build:fast": "exit 0",
"build:watch": "exit 0", "build:watch": "exit 0",
"clean": "rimraf dist", "clean": "rimraf dist",
"dev": "MODE=app NODE_ENV=development rspack serve", "dev": "MODE=app NODE_ENV=development rsbuild dev --open",
"lint": "eslint ./src --cache", "lint": "eslint ./src --cache",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"start": "NODE_ENV=development rspack serve", "start": "NODE_ENV=development rsbuild dev --open",
"test": "exit", "test": "exit",
"test:cov": "exit", "test:cov": "exit",
"watch": "exit 0" "watch": "exit 0"
@ -45,16 +45,15 @@
"devDependencies": { "devDependencies": {
"@flowgram.ai/ts-config": "workspace:*", "@flowgram.ai/ts-config": "workspace:*",
"@flowgram.ai/eslint-config": "workspace:*", "@flowgram.ai/eslint-config": "workspace:*",
"@rspack/cli": "0.2.1", "@rsbuild/core": "^1.2.16",
"@rsbuild/plugin-react": "^1.1.1",
"@rsbuild/plugin-less": "^1.1.1",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^18", "@types/node": "^18",
"@types/react": "^18", "@types/react": "^18",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"@types/styled-components": "^5", "@types/styled-components": "^5",
"@typescript-eslint/parser": "^6.10.0", "eslint": "^8.54.0"
"eslint": "^8.54.0",
"less": "^4.1.2",
"less-loader": "^6"
}, },
"publishConfig": { "publishConfig": {
"access": "public", "access": "public",

View File

@ -0,0 +1,15 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginLess } from '@rsbuild/plugin-less';
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
plugins: [pluginReact(), pluginLess()],
source: {
entry: {
index: './src/app.tsx',
},
},
html: {
title: 'demo-free-layout',
},
});

View File

@ -1,64 +0,0 @@
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
resolve: {
alias: {
react: require.resolve('react'),
'react-dom': require.resolve('react-dom'),
},
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
{
test: /\.(less|css)$/,
use: [
{
loader: 'less-loader',
options: {
// ...
},
},
],
type: 'css',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};

View File

@ -19,10 +19,10 @@
"build:fast": "exit 0", "build:fast": "exit 0",
"build:watch": "exit 0", "build:watch": "exit 0",
"clean": "rimraf dist", "clean": "rimraf dist",
"dev": "MODE=app NODE_ENV=development rspack serve", "dev": "MODE=app NODE_ENV=development rsbuild dev --open",
"lint": "eslint ./src --cache", "lint": "eslint ./src --cache",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"start": "NODE_ENV=development rspack serve", "start": "NODE_ENV=development rsbuild dev --open",
"test": "exit", "test": "exit",
"test:cov": "exit", "test:cov": "exit",
"watch": "exit 0" "watch": "exit 0"
@ -40,7 +40,8 @@
"devDependencies": { "devDependencies": {
"@flowgram.ai/ts-config": "workspace:*", "@flowgram.ai/ts-config": "workspace:*",
"@flowgram.ai/eslint-config": "workspace:*", "@flowgram.ai/eslint-config": "workspace:*",
"@rspack/cli": "0.2.1", "@rsbuild/core": "^1.2.16",
"@rsbuild/plugin-react": "^1.1.1",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^18", "@types/node": "^18",
"@types/react": "^18", "@types/react": "^18",

View File

@ -0,0 +1,14 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
plugins: [pluginReact()],
source: {
entry: {
index: './src/app.tsx',
},
},
html: {
title: 'demo-node-form',
},
});

View File

@ -1,46 +0,0 @@
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};

File diff suppressed because it is too large Load Diff