Description
Describe the bug
When enabling SSR mode by setting:
{
build: {
ssr: true,
sourcemap: true,
}
}
Sourcemaps are no longer being emitted to the output directory. This appears to be the result of the rollup 3 upgrade since that change made sourcemaps into proper assets within the bundle, and vite has existing code that removes assets from the bundle for SSR builds which was not updated to go along with this change.
I have fixed this in the following PR: #11343
Reproduction
https://stackblitz.com/edit/vitejs-vite-bqd6xy?file=vite.config.ts
Steps to reproduce
Run npm install
followed by npm run build
and check the output produced in the ./dist
folder. you will only see index.js
and index.cjs
, but there should also be index.js.map
and index.cjs.map
.
If you set ssr: false
in the vite.config.ts file and re-run the steps above, the sourcemaps are produced correctly.
System Info
System:
OS: Windows 10 10.0.22621
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
Memory: 13.68 GB / 31.64 GB
Binaries:
Node: 18.12.1 - ~\AppData\Local\Volta\tools\image\node\18.12.1\node.EXE
Yarn: 1.22.19 - ~\AppData\Local\Volta\tools\image\yarn\1.22.19\bin\yarn.CMD
npm: 8.19.2 - ~\AppData\Local\Volta\tools\image\node\18.12.1\npm.CMD
Browsers:
Edge: Spartan (44.22621.819.0), Chromium (107.0.1418.56)
Internet Explorer: 11.0.22621.1
Used Package Manager
yarn
Logs
No response
Validations
- 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 vuejs/core 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.