From e578c90bb6b73ac4f57a47d674052c3423db28bd Mon Sep 17 00:00:00 2001 From: Li Xin Date: Fri, 25 Apr 2025 10:53:46 +0800 Subject: [PATCH] chore: support both turbopack and webpack --- web/next.config.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/web/next.config.js b/web/next.config.js index fc3801c..19e5372 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -8,23 +8,32 @@ import "./src/env.js"; /** @type {import("next").NextConfig} */ + +// DeerFlow leverages **Turbopack** during development for faster builds and a smoother developer experience. +// However, in production, **Webpack** is used instead. +// +// This decision is based on the current recommendation to avoid using Turbopack for critical projects, as it +// is still evolving and may not yet be fully stable for production environments. + const config = { - rewrites: async () => [ - { - source: "/api/podcast/:path*", - destination: "http://localhost:8000/api/podcast/:path*", - }, - ], - experimental: { - turbo: { - rules: { - "*.md": { - loaders: ["raw-loader"], - as: "*.js", - }, + // For development mode + turbopack: { + rules: { + "*.md": { + loaders: ["raw-loader"], + as: "*.js", }, }, }, + + // For production mode + webpack: (config) => { + config.module.rules.push({ + test: /\.md$/, + use: "raw-loader", + }); + return config; + }, }; export default config;