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"; export default defineConfig({ plugins: [ pluginBabel({ include: /\.(?:jsx|tsx)$/, }), pluginSolid(), ], tools: { postcss: { postcssOptions: { plugins: [tailwindcss()], }, }, rspack: { resolve: { // Allow TypeScript sources to use explicit `.js` specifiers (required // by the CLI's NodeNext build) while the bundler resolves them to .ts. extensionAlias: { ".js": [".ts", ".tsx", ".js"], }, }, module: { rules: [ { // Built-in doc entries are statically imported as strings test: /[\\/]doc-entries[\\/].*\.md$/, type: "asset/source", }, ], }, plugins: [ process.env.ANALYZE ? new BundleAnalyzerPlugin() : undefined, ].filter(Boolean), }, }, html: { template: "./src/index.html", }, source: { entry: { index: "./src/main.tsx", }, }, server: { // Dev web server runs on its own port; the CLI content server keeps // port 3000 (see the proxy targets below). port: 5173, 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_REGISTRY.json": "http://localhost:3000", "/content": "http://localhost:3000", "/.ttrpg": "http://localhost:3000", }, historyApiFallback: true, }, output: { distPath: { root: "dist/web", }, }, });