Skip to content

Commit

Permalink
fix(ai): 启用serverMinification,使用--no-mangling (#1218)
Browse files Browse the repository at this point in the history
启用AI项目的服务器端代码优化serverMinification,只使用`--no-mangling`和`swcMinify:
false`来关闭name
mangling以解决[这个问题](mikro-orm/mikro-orm#5487vercel/next.js#50208 ),必须还要同时设置`swcMinify:
false`才可以。
  • Loading branch information
ddadaal committed Apr 23, 2024
1 parent 94aa24c commit a4d36e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-fishes-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/ai": patch
---

启用 serverMinification,只关闭 name mangling
5 changes: 2 additions & 3 deletions apps/ai/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ export default async () => {
const nextConfig = {
compiler: {
styledComponents: true,

},
experimental: {
serverMinification: false,
},
swcMinify: false,
basePath: BASE_PATH === "/" ? undefined : BASE_PATH,
assetPrefix: BASE_PATH === "/" ? undefined : BASE_PATH,
webpack: (config) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"serve": "node start.mjs",
"serve:next": "next start",
"build": "npm run build:next",
"build:next": "rimraf .next.backup && cross-env BUILDING=1 NEXT_PUBLIC_BASE_PATH=/@BASE_PATH@ next build",
"build:next": "rimraf .next.backup && cross-env BUILDING=1 NEXT_PUBLIC_BASE_PATH=/@BASE_PATH@ next build --no-mangling",
"build:ts": "rimraf build && tsc -p tsconfig.server.json && tsc-alias -p tsconfig.server.json",
"orm": "dotenv -e env/.env.dev -- npx mikro-orm",
"ormCreate": "dotenv -e env/.env.dev -- npx mikro-orm migration:create",
Expand Down

0 comments on commit a4d36e2

Please sign in to comment.