2026-07-08 15:16:12 +08:00
|
|
|
import { defineConfig } from "@rsbuild/core";
|
|
|
|
|
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
|
|
|
import { pluginSolid } from "@rsbuild/plugin-solid";
|
|
|
|
|
import tailwindcss from "@tailwindcss/postcss";
|
|
|
|
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
2026-02-26 00:17:23 +08:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [
|
2026-02-26 00:27:38 +08:00
|
|
|
pluginBabel({
|
|
|
|
|
include: /\.(?:jsx|tsx)$/,
|
|
|
|
|
}),
|
2026-02-26 00:17:23 +08:00
|
|
|
pluginSolid(),
|
|
|
|
|
],
|
|
|
|
|
tools: {
|
2026-02-26 08:14:42 +08:00
|
|
|
postcss: {
|
|
|
|
|
postcssOptions: {
|
|
|
|
|
plugins: [tailwindcss()],
|
|
|
|
|
},
|
2026-02-26 00:17:23 +08:00
|
|
|
},
|
2026-07-08 15:16:12 +08:00
|
|
|
rspack: {
|
2026-07-11 09:27:57 +08:00
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
// Built-in doc entries are statically imported as strings
|
|
|
|
|
test: /[\\/]doc-entries[\\/].*\.md$/,
|
|
|
|
|
type: "asset/source",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-07-08 15:16:12 +08:00
|
|
|
plugins: [
|
|
|
|
|
process.env.ANALYZE ? new BundleAnalyzerPlugin() : undefined,
|
|
|
|
|
].filter(Boolean),
|
|
|
|
|
},
|
2026-02-26 00:17:23 +08:00
|
|
|
},
|
|
|
|
|
html: {
|
2026-07-08 15:16:12 +08:00
|
|
|
template: "./src/index.html",
|
2026-02-26 00:17:23 +08:00
|
|
|
},
|
|
|
|
|
source: {
|
|
|
|
|
entry: {
|
2026-07-08 15:16:12 +08:00
|
|
|
index: "./src/main.tsx",
|
2026-02-26 00:17:23 +08:00
|
|
|
},
|
|
|
|
|
},
|
2026-07-11 09:19:41 +08:00
|
|
|
server: {
|
|
|
|
|
proxy: {
|
|
|
|
|
// Proxy content API requests to the CLI dev server (npm run tttk)
|
|
|
|
|
"/__CONTENT_INDEX.json": "http://localhost:3000",
|
|
|
|
|
"/__COMPLETIONS.json": "http://localhost:3000",
|
|
|
|
|
"/content": "http://localhost:3000",
|
2026-07-11 09:29:16 +08:00
|
|
|
"/.ttrpg": "http://localhost:3000",
|
2026-07-11 09:19:41 +08:00
|
|
|
},
|
|
|
|
|
},
|
2026-02-26 00:17:23 +08:00
|
|
|
output: {
|
|
|
|
|
distPath: {
|
2026-07-08 15:16:12 +08:00
|
|
|
root: "dist/web",
|
2026-02-26 00:17:23 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|