File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
packages/vite-plugin-web-extension/src/plugins Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -153,12 +153,14 @@ export function manifestLoaderPlugin(options: ResolvedOptions): vite.Plugin {
153
153
} ) ;
154
154
}
155
155
156
- if ( options . onBundleReady ) {
156
+ await copyPublicDirToOutDir ( { mode, paths } ) ;
157
+
158
+ // Handle the onBundleReady callback in dev mode here, as writeBundle is not called in dev mode
159
+ if ( mode === BuildMode . DEV && options . onBundleReady ) {
160
+ logger . verbose ( "Running onBundleReady" ) ;
157
161
await options . onBundleReady ( ) ;
158
162
}
159
163
160
- await copyPublicDirToOutDir ( { mode, paths } ) ;
161
-
162
164
// In dev mode, open up the browser immediately after the build context is finished with the
163
165
// first build.
164
166
if ( mode === BuildMode . DEV && ! options . disableAutoLaunch ) {
@@ -287,6 +289,14 @@ export function manifestLoaderPlugin(options: ResolvedOptions): vite.Plugin {
287
289
noInput . cleanupBundle ( bundle ) ;
288
290
} ,
289
291
292
+ // Runs during: build, watch
293
+ async writeBundle ( ) {
294
+ if ( options . onBundleReady ) {
295
+ logger . verbose ( "Running onBundleReady" ) ;
296
+ await options . onBundleReady ( ) ;
297
+ }
298
+ } ,
299
+
290
300
// Runs during: watch, dev
291
301
async watchChange ( id ) {
292
302
if (
You can’t perform that action at this time.
0 commit comments