Error when evaluating SSR module ./server.mjs: Cannot split a chunk that has already been edited (0:76 – "import.meta")
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- angular, typescript, vite
- Domain
- build-system, devtools
Research direction
Unpack testing-app.zip and inspect src/server.ts, especially line 20, then reproduce the failure with npx ng serve. Trace the SSR transformation shown in the Vite stack and compare behavior with that line enabled or commented; done means the minimal reproduction serves successfully with the intended server code intact.
Written by the indexing model from the issue text.
Description
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
I just created an Angular application and
- Added Hono and configured it for SSR
- Added Drizzle ORM
- Added Better Auth
I configured every library following their documentation, but when I run npx ng serve I get this error :
6:31:46 PM [vite] (ssr) Error when evaluating SSR module ./server.mjs: Cannot split a chunk that has already been edited (0:76 – "import.meta")
at MagicString._splitChunk (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3823:10)
at MagicString._split (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3814:43)
at MagicString.update (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3638:8)
at onIdentifier (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16139:77)
at file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16251:37
at Array.forEach (<anonymous>)
at walk$1 (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16250:14)
at ssrTransformScript (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16116:2)
at async loadAndTransform (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:23318:64)
at async fetchModule (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:34612:15)
Commenting line 20 of src/server.ts, then re-running the serve command makes it work.
Minimal Reproduction
Exception or Error
6:31:46 PM [vite] (ssr) Error when evaluating SSR module ./server.mjs: Cannot split a chunk that has already been edited (0:76 – "import.meta")
at MagicString._splitChunk (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3823:10)
at MagicString._split (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3814:43)
at MagicString.update (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:3638:8)
at onIdentifier (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16139:77)
at file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16251:37
at Array.forEach (<anonymous>)
at walk$1 (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16250:14)
at ssrTransformScript (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:16116:2)
at async loadAndTransform (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:23318:64)
at async fetchModule (file:///home/max/projects/migal/mi-points/node_modules/vite/dist/node/chunks/config.js:34612:15)
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.0.1
Angular : 21.0.1
Node.js : 22.18.0
Package Manager : npm 11.6.1
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.0.1 │ ^21.0.1 │
│ @angular/cli │ 21.0.1 │ ^21.0.1 │
│ @angular/common │ 21.0.1 │ ^21.0.0 │
│ @angular/compiler │ 21.0.1 │ ^21.0.0 │
│ @angular/compiler-cli │ 21.0.1 │ ^21.0.0 │
│ @angular/core │ 21.0.1 │ ^21.0.0 │
│ @angular/forms │ 21.0.1 │ ^21.0.0 │
│ @angular/platform-browser │ 21.0.1 │ ^21.0.0 │
│ @angular/platform-server │ 21.0.1 │ ^21.0.0 │
│ @angular/router │ 21.0.1 │ ^21.0.0 │
│ @angular/ssr │ 21.0.1 │ ^21.0.1 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.0.14 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
- Dominant language
- TypeScript
- Stars
- 27k
- Forks
- 11.8k
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 176
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from angular/angular-cli
-
area: @angular/build gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
angular/angular-cli#33055 · 1 comment · 3 reactions ·
-
area: @angular/build gemini-triaged
Difficulty 4/5 3-5 days Newbie friendliness 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 assignee ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 assignee ·
All issues in angular/angular-cli
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·