From 35cddd77a74feb85e58f12e8f7c8d04ccdc53fe4 Mon Sep 17 00:00:00 2001 From: qixuan <58852732+GiveMe-A-Name@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:27:31 +0800 Subject: [PATCH] fix: prod-server support source-map (#5930) --- .changeset/fifty-bugs-try.md | 6 ++++++ packages/server/prod-server/package.json | 2 ++ packages/server/prod-server/src/index.ts | 3 +++ pnpm-lock.yaml | 14 +++++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .changeset/fifty-bugs-try.md diff --git a/.changeset/fifty-bugs-try.md b/.changeset/fifty-bugs-try.md new file mode 100644 index 000000000000..54f9d53aaaf8 --- /dev/null +++ b/.changeset/fifty-bugs-try.md @@ -0,0 +1,6 @@ +--- +'@modern-js/prod-server': patch +--- + +fix: prod-server support source-map +fix: prod-server 支持 source-map diff --git a/packages/server/prod-server/package.json b/packages/server/prod-server/package.json index 7d0d4133e3aa..7578ef60440d 100644 --- a/packages/server/prod-server/package.json +++ b/packages/server/prod-server/package.json @@ -49,6 +49,7 @@ "dependencies": { "@modern-js/server-core": "workspace:*", "@modern-js/runtime-utils": "workspace:*", + "source-map-support": "0.5.21", "@modern-js/utils": "workspace:*", "@swc/helpers": "0.5.3" }, @@ -57,6 +58,7 @@ "@scripts/build": "workspace:*", "@modern-js/types": "workspace:*", "@types/merge-deep": "^3.0.0", + "@types/source-map-support": "0.5.10", "@types/node": "~16.11.7", "husky": "^8.0.0", "jest": "^29", diff --git a/packages/server/prod-server/src/index.ts b/packages/server/prod-server/src/index.ts index b91225e80dc8..439f86f695a3 100644 --- a/packages/server/prod-server/src/index.ts +++ b/packages/server/prod-server/src/index.ts @@ -5,9 +5,12 @@ import { loadServerEnv, } from '@modern-js/server-core/node'; import { createServerBase } from '@modern-js/server-core'; +import sourceMapSupport from 'source-map-support'; import { BaseEnv, ProdServerOptions } from './types'; import { applyPlugins } from './apply'; +sourceMapSupport.install(); + export { applyPlugins, type ApplyPlugins } from './apply'; export { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e345fe8fc298..083cb7437288 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3675,6 +3675,9 @@ importers: '@swc/helpers': specifier: 0.5.3 version: 0.5.3 + source-map-support: + specifier: 0.5.21 + version: 0.5.21 devDependencies: '@modern-js/eslint-config': specifier: workspace:* @@ -3697,6 +3700,9 @@ importers: '@types/node': specifier: ~16.11.7 version: 16.11.68 + '@types/source-map-support': + specifier: 0.5.10 + version: 0.5.10 husky: specifier: ^8.0.0 version: 8.0.1 @@ -20287,6 +20293,12 @@ packages: /@types/source-list-map@0.1.2: resolution: {integrity: sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==} + /@types/source-map-support@0.5.10: + resolution: {integrity: sha512-tgVP2H469x9zq34Z0m/fgPewGhg/MLClalNOiPIzQlXrSS2YrKu/xCdSCKnEDwkFha51VKEKB6A9wW26/ZNwzA==} + dependencies: + source-map: 0.6.1 + dev: true + /@types/stack-utils@2.0.1: resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} @@ -37241,7 +37253,7 @@ packages: '@webassemblyjs/wasm-parser': 1.12.1 acorn: 8.11.3 acorn-import-attributes: 1.9.5(acorn@8.11.3) - browserslist: 4.23.1 + browserslist: 4.23.0 chrome-trace-event: 1.0.3 enhanced-resolve: 5.17.0 es-module-lexer: 1.2.1