Skip to content

Commit

Permalink
chore: add rsbuild to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Feb 9, 2024
1 parent 6990f0b commit 421ea96
Show file tree
Hide file tree
Showing 3 changed files with 615 additions and 250 deletions.
6 changes: 6 additions & 0 deletions packages/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"@playwright/test": "^1.41.1",
"@rainbow-me/rainbowkit": "^0.12.18",
"@redux-devtools/extension": "^3.2.3",
"@rsbuild/core": "^0.4.1",
"@rsbuild/plugin-react": "^0.3.11",
"@rsbuild/plugin-svgr": "^0.3.11",
"@rsdoctor/rspack-plugin": "^0.1.1",
"@synthetixio/synpress": "3.7.2-beta.10",
"@tailwindcss/line-clamp": "^0.4.2",
"@tailwindcss/typography": "^0.5.9",
Expand Down Expand Up @@ -56,6 +60,8 @@
"history": "^5.3.0",
"https-browserify": "^1.0.0",
"jest": "^27.0",
"jszip": "^3.10.1",
"localforage": "^1.10.0",
"os-browserify": "^0.3.0",
"pnpm": "7",
"postcss": "^8.4.14",
Expand Down
41 changes: 41 additions & 0 deletions packages/builder/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { defineConfig, loadEnv } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { pluginSvgr } from "@rsbuild/plugin-svgr";
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
const path = require("path");

const { publicVars } = loadEnv({ prefixes: ["REACT_APP_"] });

export default defineConfig({
plugins: [pluginReact(), pluginSvgr()],
html: {
template: "./public/index.html",
},
server: {
port: Number(process.env.PORT) || 3000,
},
source: {
define: publicVars,
alias: {
localforage: path.resolve(
__dirname,
"./node_modules/localforage/src/localforage.js"
),
jszip: path.resolve(__dirname, "./node_modules/jszip/lib/index.js"),
"readable-stream": require.resolve("readable-stream"),
"csv-stringify": "csv-stringify/browser/esm",
},
},
tools: {
rspack(config, { appendPlugins }) {
// Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time.
if (process.env.RSDOCTOR) {
appendPlugins(
new RsdoctorRspackPlugin({
// plugin options
})
);
}
},
},
});
Loading

0 comments on commit 421ea96

Please sign in to comment.