@@ -12,8 +12,7 @@ const importMetaEnvMarker = '__vite_import_meta_env__'
1212const importMetaEnvKeyReCache = new Map < string , RegExp > ( )
1313
1414export function definePlugin ( config : ResolvedConfig ) : Plugin {
15- const isBuild =
16- config . command === 'build' || config . experimental . fullBundleMode
15+ const isBuild = config . command === 'build'
1716 const isBuildLib = isBuild && config . build . lib
1817
1918 // ignore replace process.env in lib build
@@ -34,7 +33,7 @@ export function definePlugin(config: ResolvedConfig): Plugin {
3433 const importMetaKeys : Record < string , string > = { }
3534 const importMetaEnvKeys : Record < string , string > = { }
3635 const importMetaFallbackKeys : Record < string , string > = { }
37- if ( isBuild ) {
36+ if ( isBuild && ! config . experimental . fullBundleMode ) {
3837 importMetaKeys [ 'import.meta.hot' ] = `undefined`
3938 for ( const key in config . env ) {
4039 const val = JSON . stringify ( config . env [ key ] )
@@ -55,7 +54,11 @@ export function definePlugin(config: ResolvedConfig): Plugin {
5554 userDefine [ key ] = handleDefineValue ( environment . config . define [ key ] )
5655
5756 // make sure `import.meta.env` object has user define properties
58- if ( isBuild && key . startsWith ( 'import.meta.env.' ) ) {
57+ if (
58+ isBuild &&
59+ ! config . experimental . fullBundleMode &&
60+ key . startsWith ( 'import.meta.env.' )
61+ ) {
5962 userDefineEnv [ key . slice ( 16 ) ] = environment . config . define [ key ]
6063 }
6164 }
@@ -129,7 +132,11 @@ export function definePlugin(config: ResolvedConfig): Plugin {
129132
130133 transform : {
131134 async handler ( code , id ) {
132- if ( this . environment . config . consumer === 'client' && ! isBuild ) {
135+ if (
136+ this . environment . config . consumer === 'client' &&
137+ ! isBuild &&
138+ ! config . experimental . fullBundleMode
139+ ) {
133140 // for dev we inject actual global defines in the vite client to
134141 // avoid the transform cost. see the `clientInjection` and
135142 // `importAnalysis` plugin.
0 commit comments