Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/vite/bin/vite.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { performance } from 'node:perf_hooks'
import module from 'node:module'

if (!import.meta.url.includes('node_modules')) {
try {
// only available as dev dependency
await import('source-map-support').then((r) => r.default.install())
} catch {}
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- only used in dev
process.setSourceMapsEnabled(true)

process.on('unhandledRejection', (err) => {
throw new Error('UNHANDLED PROMISE REJECTION', { cause: err })
Expand Down
1 change: 0 additions & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"sass": "^1.89.0",
"sass-embedded": "^1.89.0",
"sirv": "^3.0.1",
"source-map-support": "^0.5.21",
"strip-literal": "^3.0.0",
"terser": "^5.39.2",
"tsconfck": "^3.1.6",
Expand Down
15 changes: 13 additions & 2 deletions packages/vite/rolldown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import licensePlugin from './rollupLicensePlugin'
const pkg = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url)).toString(),
)

const __dirname = fileURLToPath(new URL('.', import.meta.url))

const envConfig = defineConfig({
Expand Down Expand Up @@ -143,6 +142,7 @@ const nodeConfig = defineConfig({
'Vite',
) as Plugin,
writeTypesPlugin(),
enableSourceMapsInWatchModePlugin(),
externalizeDepsInWatchPlugin(),
],
})
Expand All @@ -158,7 +158,7 @@ const moduleRunnerConfig = defineConfig({
'rollup/parseAst',
...Object.keys(pkg.dependencies),
],
plugins: [bundleSizeLimit(54)],
plugins: [bundleSizeLimit(54), enableSourceMapsInWatchModePlugin()],
output: {
...sharedNodeOptions.output,
minify: {
Expand All @@ -178,6 +178,17 @@ export default defineConfig([

// #region Plugins

function enableSourceMapsInWatchModePlugin(): Plugin {
return {
name: 'enable-source-maps',
outputOptions(options) {
if (this.meta.watchMode) {
options.sourcemap = 'inline'
}
},
}
}

function writeTypesPlugin(): Plugin {
return {
name: 'write-types',
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.