chore: support both turbopack and webpack

This commit is contained in:
Li Xin 2025-04-25 10:53:46 +08:00
parent f6af751e95
commit e578c90bb6

View File

@ -8,23 +8,32 @@
import "./src/env.js"; import "./src/env.js";
/** @type {import("next").NextConfig} */ /** @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 = { const config = {
rewrites: async () => [ // For development mode
{ turbopack: {
source: "/api/podcast/:path*", rules: {
destination: "http://localhost:8000/api/podcast/:path*", "*.md": {
}, loaders: ["raw-loader"],
], as: "*.js",
experimental: {
turbo: {
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; export default config;