build: adjust global names + allow inline overrides of build flags

This commit is contained in:
Evan You 2019-12-15 15:37:43 -05:00
parent 75113c8d3e
commit 35858cec8c
7 changed files with 15 additions and 5 deletions

View File

@ -10,6 +10,7 @@
], ],
"types": "dist/compiler-core.d.ts", "types": "dist/compiler-core.d.ts",
"buildOptions": { "buildOptions": {
"name": "VueCompilerCore",
"formats": [ "formats": [
"esm-bundler", "esm-bundler",
"cjs" "cjs"

View File

@ -12,7 +12,7 @@
"unpkg": "dist/compiler-dom/global.js", "unpkg": "dist/compiler-dom/global.js",
"sideEffects": false, "sideEffects": false,
"buildOptions": { "buildOptions": {
"name": "VueDOMCompiler", "name": "VueCompilerDOM",
"formats": [ "formats": [
"esm-bundler", "esm-bundler",
"cjs", "cjs",

View File

@ -16,7 +16,7 @@
"url": "git+https://github.com/vuejs/vue.git" "url": "git+https://github.com/vuejs/vue.git"
}, },
"buildOptions": { "buildOptions": {
"name": "VueObserver", "name": "VueReactivity",
"formats": [ "formats": [
"esm-bundler", "esm-bundler",
"cjs", "cjs",

View File

@ -10,6 +10,7 @@
], ],
"types": "dist/runtime-core.d.ts", "types": "dist/runtime-core.d.ts",
"buildOptions": { "buildOptions": {
"name": "VueRuntimeCore",
"formats": [ "formats": [
"esm-bundler", "esm-bundler",
"cjs" "cjs"

View File

@ -12,7 +12,7 @@
"unpkg": "dist/runtime-dom.global.js", "unpkg": "dist/runtime-dom.global.js",
"sideEffects": false, "sideEffects": false,
"buildOptions": { "buildOptions": {
"name": "VueDOMRuntime", "name": "VueRuntimeDOM",
"formats": [ "formats": [
"esm-bundler", "esm-bundler",
"cjs", "cjs",

View File

@ -15,7 +15,7 @@
"url": "git+https://github.com/vuejs/vue.git" "url": "git+https://github.com/vuejs/vue.git"
}, },
"buildOptions": { "buildOptions": {
"name": "VueTestRuntime", "name": "VueRuntimeTest",
"formats": [ "formats": [
"global" "global"
] ]

View File

@ -135,7 +135,7 @@ function createReplacePlugin(
isBrowserBuild, isBrowserBuild,
isRuntimeCompileBuild isRuntimeCompileBuild
) { ) {
return replace({ const replacements = {
__COMMIT__: `"${process.env.COMMIT}"`, __COMMIT__: `"${process.env.COMMIT}"`,
__VERSION__: `"${masterVersion}"`, __VERSION__: `"${masterVersion}"`,
__DEV__: isBundlerESMBuild __DEV__: isBundlerESMBuild
@ -155,7 +155,15 @@ function createReplacePlugin(
// the lean build drops options related code with buildOptions.lean: true // the lean build drops options related code with buildOptions.lean: true
__FEATURE_OPTIONS__: !packageOptions.lean && !process.env.LEAN, __FEATURE_OPTIONS__: !packageOptions.lean && !process.env.LEAN,
__FEATURE_SUSPENSE__: true __FEATURE_SUSPENSE__: true
}
// allow inline overrides like
//__RUNTIME_COMPILE__=true yarn build runtime-core
Object.keys(replacements).forEach(key => {
if (key in process.env) {
replacements[key] = process.env[key]
}
}) })
return replace(replacements)
} }
function createProductionConfig(format) { function createProductionConfig(format) {