diff --git a/rsdoctor/arco-pro/package.json b/rsdoctor/arco-pro/package.json index 064604af..b8eb957e 100644 --- a/rsdoctor/arco-pro/package.json +++ b/rsdoctor/arco-pro/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "dev": "rspack serve", - "doctor": "RSDOCTOR=true rspack serve", + "build:analysis": "RSDOCTOR=true rspack serve", "build": "rspack build", "analyze": "pnpm run build --analyze", "preview": "cd dist && serve -s", @@ -55,7 +55,7 @@ "serve": "14.1.2", "style-loader": "^3.3.1", "swc-loader": "^0.2.3", - "@rsdoctor/rspack-plugin": "0.1.0" + "@rsdoctor/rspack-plugin": "^0.1.8" }, "browserslist": { "production": [ diff --git a/rsdoctor/modern-minimal/modern.config.ts b/rsdoctor/modern-minimal/modern.config.ts index b06882c8..8c02d8dc 100644 --- a/rsdoctor/modern-minimal/modern.config.ts +++ b/rsdoctor/modern-minimal/modern.config.ts @@ -1,9 +1,9 @@ import { appTools, defineConfig } from '@modern-js/app-tools'; -import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin'; +import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'; const pluginName = 'Rsdoctor'; -export default defineConfig({ +export default defineConfig<'rspack'>({ runtime: { router: true, state: true, @@ -21,13 +21,10 @@ export default defineConfig({ }, plugins: [appTools()], tools: { - bundlerChain: (chain) => { - chain.plugin(pluginName).use(RsdoctorWebpackPlugin, [ - { - disableClientServer: !process.env.ENABLE_CLIENT_SERVER, - features: ['bundle', 'plugins', 'loader', 'resolver'], - }, - ]); + rspack: (config, { appendPlugins }) => { + if (process.env.RSDOCTOR === 'true') { + appendPlugins([new RsdoctorRspackPlugin()]); + } }, }, }); diff --git a/rsdoctor/modern-minimal/package.json b/rsdoctor/modern-minimal/package.json index 7a11b1ec..9c7e6ed0 100644 --- a/rsdoctor/modern-minimal/package.json +++ b/rsdoctor/modern-minimal/package.json @@ -1,15 +1,9 @@ { - "name": "@examples/doctor-modern-minimal", + "name": "rsdoctor-modern-minimal", "version": "0.0.1", "description": "", - "files": [ - "dist", - "src", - "package.json" - ], "scripts": { - "start:analysis": "ENABLE_CLIENT_SERVER=true modern start", - "build:analysis": "ENABLE_CLIENT_SERVER=true modern build", + "build:analysis": "RSDOCTOR=true modern build", "build": "modern build" }, "author": "", @@ -22,9 +16,9 @@ "react-dom": "^18" }, "devDependencies": { - "@modern-js/runtime": "2.41.0", - "@rsdoctor/webpack-plugin": "0.1.7", - "@modern-js/app-tools": "2.41.0", + "@modern-js/runtime": "2.48.3", + "@rsdoctor/rspack-plugin": "^0.1.8", + "@modern-js/app-tools": "2.48.3", "@types/node": "14.18.26", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/rsdoctor/modern-minimal/tsconfig.json b/rsdoctor/modern-minimal/tsconfig.json index 262f3191..2d77f110 100644 --- a/rsdoctor/modern-minimal/tsconfig.json +++ b/rsdoctor/modern-minimal/tsconfig.json @@ -4,7 +4,7 @@ "target": "ES2019", "lib": ["DOM", "ESNext"], "allowJs": true, - "module": "ES2020", + "module": "NodeNext", "outDir": "dist", "baseUrl": ".", "strict": true, @@ -15,7 +15,7 @@ "noUnusedParameters": true, "jsx": "preserve", "resolveJsonModule": true, - "moduleResolution": "Bundler" + "moduleResolution": "NodeNext" }, "$schema": "https://json.schemastore.org/tsconfig", "display": "Base" diff --git a/rsdoctor/next-minimal/next.config.mjs b/rsdoctor/next-minimal/next.config.mjs index 41f2cfea..ef31aa96 100644 --- a/rsdoctor/next-minimal/next.config.mjs +++ b/rsdoctor/next-minimal/next.config.mjs @@ -3,11 +3,13 @@ import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin'; const nextConfig = { webpack: (config) => { + if (process.env.RSDOCTOR === 'true') { config.plugins.push( new RsdoctorWebpackPlugin({ disableClientServer: true, }) ) + } return config }, }; diff --git a/rsdoctor/next-minimal/package.json b/rsdoctor/next-minimal/package.json index 7e38bb92..5e68da24 100644 --- a/rsdoctor/next-minimal/package.json +++ b/rsdoctor/next-minimal/package.json @@ -1,13 +1,14 @@ { - "name": "next-app", + "name": "rsdoctor-next-app", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", + "doctor": "RSDOCTOR=true next build", "start": "next start", "lint": "next lint", - "doctor": "npm run build && npx rsdoctor analyze --profile ./.next/.rsdoctor/manifest.json" + "build:analysis": "npm run doctor && npx rsdoctor analyze --profile ./.next/.rsdoctor/manifest.json" }, "dependencies": { "next": "14.1.0", @@ -16,8 +17,8 @@ "react-dom": "^18" }, "devDependencies": { - "@rsdoctor/cli": "^0.1.7", - "@rsdoctor/webpack-plugin": "0.1.7", + "@rsdoctor/cli": "^0.1.8", + "@rsdoctor/webpack-plugin": "^0.1.8", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/rsdoctor/rsbuild-minimal/package.json b/rsdoctor/rsbuild-minimal/package.json index e361c1c6..adf0c9a5 100644 --- a/rsdoctor/rsbuild-minimal/package.json +++ b/rsdoctor/rsbuild-minimal/package.json @@ -8,8 +8,7 @@ "package.json" ], "scripts": { - "start:analysis": "ENABLE_CLIENT_SERVER=true rsbuild dev", - "build:analysis": "ENABLE_CLIENT_SERVER=true rsbuild build", + "build:analysis": "RSDOCTOR=true rsbuild build", "build": "rsbuild build" }, "author": "", @@ -21,9 +20,9 @@ "semver7": "npm:semver@7.5.4" }, "devDependencies": { - "@rsbuild/core": "0.3.0", - "@rsbuild/plugin-react": "0.3.0", - "@rsdoctor/rspack-plugin": "0.1.7", + "@rsbuild/core": "0.5.2", + "@rsbuild/plugin-react": "0.5.2", + "@rsdoctor/rspack-plugin": "^0.1.8", "@types/react": "^18", "@types/react-dom": "^18", "@types/semver6": "npm:@types/semver@7.5.6", diff --git a/rsdoctor/rsbuild-minimal/rsbuild.config.ts b/rsdoctor/rsbuild-minimal/rsbuild.config.ts index be54878a..bbb09c73 100644 --- a/rsdoctor/rsbuild-minimal/rsbuild.config.ts +++ b/rsdoctor/rsbuild-minimal/rsbuild.config.ts @@ -6,16 +6,7 @@ export default defineConfig({ plugins: [pluginReact()], tools: { bundlerChain: (chain) => { - chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [ - { - disableClientServer: !process.env.ENABLE_CLIENT_SERVER, - features: ['bundle', 'plugins', 'loader', 'resolver'] - }, - ]); + process.env.RSDOCTOR === 'true' && chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [{}]); } }, - output: { - disableFilenameHash: true, - disableMinimize: true - } });