refactor: use __TEST__ flag

This commit is contained in:
Evan You
2019-11-04 11:24:22 -05:00
parent fec47bb3ac
commit 300a705221
6 changed files with 23 additions and 15 deletions

View File

@@ -147,9 +147,11 @@ function createReplacePlugin(
__VERSION__: `"${lernaJson.version}"`,
__DEV__: isBundlerESMBuild
? // preserve to be handled by bundlers
`process.env.NODE_ENV !== 'production'`
`(process.env.NODE_ENV !== 'production')`
: // hard coded dev/prod builds
!isProduction,
// this is only used during tests
__TEST__: isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : false,
// If the build is expected to run directly in the browser (global / esm-browser builds)
__BROWSER__: isBrowserBuild,
// support compile in browser?
@@ -157,9 +159,7 @@ function createReplacePlugin(
// support options?
// the lean build drops options related code with buildOptions.lean: true
__FEATURE_OPTIONS__: !packageOptions.lean && !process.env.LEAN,
__FEATURE_SUSPENSE__: true,
// this is only used during tests
__JSDOM__: false
__FEATURE_SUSPENSE__: true
})
}