-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Cannot build typescript ssr file #4887
Copy link
Copy link
Closed
Milestone
Description
Describe the bug
When trying to get SSR working, the sample project will not build in production mode. I think the code which sets process.env.NODE_ENV is being replaced, so that variable can't be assigned?
$ /Users/jakeginnivan/_code/vite-ts-ssr/vite-project/node_modules/.bin/vite build --outDir dist/server --ssr src/entry-server.ts
vite v2.5.6 building SSR bundle for production...
✓ 62 modules transformed.
[commonjs] Assigning to rvalue (33444:4) in /Users/jakeginnivan/_code/vite-ts-ssr/vite-project/node_modules/vite/dist/node/chunks/dep-9f74b403.js
file: /Users/jakeginnivan/_code/vite-ts-ssr/vite-project/node_modules/vite/dist/node/chunks/dep-9f74b403.js:33444:4
33442:
33443: if (!ctx.env) {
33444: process.env.NODE_ENV = 'development';
^
33445: }
My naive guess is that what is actually happening is 'production' = 'development'?
It is possible this is another variation of #3229, but thought I would open a fresh issue because the symptoms are a bit different.
Reproduction
Then run yarn && yarn vite build --outDir dist/server --ssr src/entry-server.ts.
System Info
npx: installed 1 in 1.542s
System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 258.38 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.3 - /usr/local/opt/node@14/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.13 - /usr/local/opt/node@14/bin/npm
Browsers:
Chrome: 93.0.4577.63
Firefox: 91.0.2
Safari: 14.1.2
npmPackages:
vite: ^2.5.4 => 2.5.6Used Package Manager
yarn
Logs
--debug flag offered no additional info over the above errorValidations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels