@@ -102,15 +102,6 @@ async function getOutputRollupOptions( {
102102 } ;
103103}
104104
105- const fileOverrides = new Map ( ) ;
106-
107- function setOverride ( filePath , source ) {
108-
109- // We want normalized paths in overrides as they will be matched
110- // against normalized paths in the file overrides Rollup plugin.
111- fileOverrides . set ( path . resolve ( filePath ) , source ) ;
112- }
113-
114105function unique ( array ) {
115106 return [ ...new Set ( array ) ] ;
116107}
@@ -179,6 +170,15 @@ async function build( {
179170} = { } ) {
180171 const pureSlim = slim && ! exclude . length && ! include . length ;
181172
173+ const fileOverrides = new Map ( ) ;
174+
175+ function setOverride ( filePath , source ) {
176+
177+ // We want normalized paths in overrides as they will be matched
178+ // against normalized paths in the file overrides Rollup plugin.
179+ fileOverrides . set ( path . resolve ( filePath ) , source ) ;
180+ }
181+
182182 // Add the short commit hash to the version string
183183 // when the version is not for a release.
184184 if ( ! version ) {
@@ -280,11 +280,6 @@ async function build( {
280280 ) ;
281281 }
282282
283- const bundle = await rollup . rollup ( {
284- ...inputOptions ,
285- plugins : [ rollupFileOverrides ( fileOverrides ) ]
286- } ) ;
287-
288283 const outputOptions = await getOutputRollupOptions ( { esm, factory } ) ;
289284
290285 if ( watch ) {
@@ -326,6 +321,11 @@ async function build( {
326321
327322 return watcher ;
328323 } else {
324+ const bundle = await rollup . rollup ( {
325+ ...inputOptions ,
326+ plugins : [ rollupFileOverrides ( fileOverrides ) ]
327+ } ) ;
328+
329329 const {
330330 output : [ { code } ]
331331 } = await bundle . generate ( outputOptions ) ;
0 commit comments