refactor: replace webpack context loading with dev server proxy

Remove the webpack-based file indexing strategy in favor of a proxy
approach. The dev server now proxies content requests to a local CLI
server, simplifying the data loading logic and removing webpack-specific
types and loaders.
This commit is contained in:
2026-07-11 09:19:41 +08:00
parent 52563fd3ef
commit c661d2a1d2
3 changed files with 22 additions and 61 deletions
+9 -13
View File
@@ -18,15 +18,6 @@ export default defineConfig({
},
},
rspack: {
module: {
rules: [
{
test: /\.md|\.yarn|\.csv$/,
exclude: /\.schema\.csv$/,
type: "asset/source",
},
],
},
plugins: [
process.env.ANALYZE ? new BundleAnalyzerPlugin() : undefined,
].filter(Boolean),
@@ -40,13 +31,18 @@ export default defineConfig({
index: "./src/main.tsx",
},
},
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",
"/journal": "http://localhost:3000",
},
},
output: {
distPath: {
root: "dist/web",
},
copy:
process.env.NODE_ENV === "development"
? [{ from: "./content", to: "content" }]
: [],
},
});