@@ -45,11 +45,13 @@ export async function resolvePlugins(
45
45
normalPlugins : Plugin [ ] ,
46
46
postPlugins : Plugin [ ] ,
47
47
) : Promise < Plugin [ ] > {
48
+ const rolldownDev = config . experimental . rolldownDev
48
49
const isBuild = config . command === 'build'
49
50
const isWorker = config . isWorker
50
- const buildPlugins = isBuild
51
- ? await ( await import ( '../build' ) ) . resolveBuildPlugins ( config )
52
- : { pre : [ ] , post : [ ] }
51
+ const buildPlugins =
52
+ isBuild || rolldownDev
53
+ ? await ( await import ( '../build' ) ) . resolveBuildPlugins ( config )
54
+ : { pre : [ ] , post : [ ] }
53
55
const { modulePreload } = config . build
54
56
const depOptimizationEnabled =
55
57
! isBuild &&
@@ -60,7 +62,7 @@ export async function resolvePlugins(
60
62
61
63
return [
62
64
depOptimizationEnabled ? optimizedDepsPlugin ( ) : null ,
63
- isBuild ? metadataPlugin ( ) : null ,
65
+ rolldownDev || isBuild ? metadataPlugin ( ) : null ,
64
66
! isWorker ? watchPackageDataPlugin ( config . packageCache ) : null ,
65
67
! isBuild ? preAliasPlugin ( config ) : null ,
66
68
enableNativePlugin
@@ -123,9 +125,18 @@ export async function resolvePlugins(
123
125
htmlInlineProxyPlugin ( config ) ,
124
126
cssPlugin ( config ) ,
125
127
config . oxc !== false
126
- ? enableNativePlugin
127
- ? nativeTransformPlugin ( )
128
- : oxcPlugin ( config )
128
+ ? rolldownDev
129
+ ? perEnvironmentPlugin (
130
+ 'native:transform' ,
131
+ ( environment ) =>
132
+ nativeTransformPlugin ( {
133
+ reactRefresh :
134
+ environment . name === 'client' && rolldownDev ?. reactRefresh ,
135
+ } ) as unknown as Plugin ,
136
+ )
137
+ : enableNativePlugin
138
+ ? nativeTransformPlugin ( )
139
+ : oxcPlugin ( config )
129
140
: null ,
130
141
enableNativePlugin
131
142
? nativeJsonPlugin ( {
@@ -146,7 +157,7 @@ export async function resolvePlugins(
146
157
enableNativePlugin ? nativeWasmFallbackPlugin ( ) : wasmFallbackPlugin ( ) ,
147
158
definePlugin ( config ) ,
148
159
cssPostPlugin ( config ) ,
149
- isBuild && buildHtmlPlugin ( config ) ,
160
+ ( rolldownDev || isBuild ) && buildHtmlPlugin ( config ) ,
150
161
workerImportMetaUrlPlugin ( config ) ,
151
162
assetImportMetaUrlPlugin ( config ) ,
152
163
...buildPlugins . pre ,
0 commit comments