Skip to content

Commit 3092532

Browse files
committed
fix: no rolldownDev on build
1 parent a4ff6e5 commit 3092532

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

packages/vite/src/node/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,9 +1058,7 @@ export async function resolveConfig(
10581058
// run config hooks
10591059
const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins]
10601060
config = await runConfigHook(config, userPlugins, configEnv)
1061-
if (config.experimental?.rolldownDev) {
1062-
config = mergeConfig(config, rolldownDevHandleConfig(config))
1063-
}
1061+
config = mergeConfig(config, rolldownDevHandleConfig(config, configEnv))
10641062

10651063
// Ensure default client and ssr environments
10661064
// If there are present, ensure order { client, ssr, ...custom }

packages/vite/src/node/server/environments/rolldown.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import sirv from 'sirv'
1010
import { createLogger } from '../../publicUtils'
1111
import { DevEnvironment } from '../environment'
1212
import type {
13+
ConfigEnv,
1314
DevEnvironmentOptions,
1415
HmrContext,
1516
ResolvedConfig,
@@ -32,7 +33,17 @@ const logger = createLogger('info', {
3233
allowClearScreen: false,
3334
})
3435

35-
export function rolldownDevHandleConfig(config: UserConfig): UserConfig {
36+
export function rolldownDevHandleConfig(
37+
config: UserConfig,
38+
env: ConfigEnv,
39+
): UserConfig {
40+
if (!config.experimental?.rolldownDev) {
41+
return {}
42+
}
43+
if (env.command === 'build') {
44+
delete config.experimental?.rolldownDev
45+
return {}
46+
}
3647
return {
3748
appType: 'custom',
3849
optimizeDeps: {

playground/rolldown-dev-react/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"dev": "vite"
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview"
79
},
810
"dependencies": {
911
"react": "^18.3.1",

0 commit comments

Comments
 (0)