File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' vite-plugin-static-copy ' : patch
3+ ---
4+
5+ Only skip non-client environments when multiple environments exist.
Original file line number Diff line number Diff line change @@ -18,12 +18,22 @@ export const buildPlugin = ({
1818 config = _config
1919 } ,
2020 buildEnd ( ) {
21- if ( this . environment && this . environment . name !== 'client' ) return
21+ if (
22+ this . environment &&
23+ Object . keys ( config . environments ) . length > 1 &&
24+ this . environment . name !== 'client'
25+ )
26+ return
2227 // reset for watch mode
2328 output = false
2429 } ,
2530 async [ hook as 'writeBundle' ] ( ) {
26- if ( this . environment && this . environment . name !== 'client' ) return
31+ if (
32+ this . environment &&
33+ Object . keys ( config . environments ) . length > 1 &&
34+ this . environment . name !== 'client'
35+ )
36+ return
2737 // run copy only once even if multiple bundles are generated
2838 if ( output ) return
2939 output = true
Original file line number Diff line number Diff line change @@ -57,7 +57,12 @@ export const servePlugin = ({
5757 config = _config
5858 } ,
5959 async buildStart ( ) {
60- if ( this . environment && this . environment . name !== 'client' ) return
60+ if (
61+ this . environment &&
62+ Object . keys ( config . environments ) . length > 1 &&
63+ this . environment . name !== 'client'
64+ )
65+ return
6166 await collectFileMap ( )
6267 } ,
6368 configureServer ( { httpServer, middlewares, ws } ) {
@@ -148,7 +153,12 @@ export const servePlugin = ({
148153 }
149154 } ,
150155 async closeBundle ( ) {
151- if ( this . environment && this . environment . name !== 'client' ) return
156+ if (
157+ this . environment &&
158+ Object . keys ( config . environments ) . length > 1 &&
159+ this . environment . name !== 'client'
160+ )
161+ return
152162 await watcher . close ( )
153163 } ,
154164 }
You can’t perform that action at this time.
0 commit comments