From 35858cec8cfdc9f3d45f7094c066359de3b2c289 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 15 Dec 2019 15:37:43 -0500 Subject: [PATCH] build: adjust global names + allow inline overrides of build flags --- packages/compiler-core/package.json | 1 + packages/compiler-dom/package.json | 2 +- packages/reactivity/package.json | 2 +- packages/runtime-core/package.json | 1 + packages/runtime-dom/package.json | 2 +- packages/runtime-test/package.json | 2 +- rollup.config.js | 10 +++++++++- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/compiler-core/package.json b/packages/compiler-core/package.json index 5f631173..ef6ab9ad 100644 --- a/packages/compiler-core/package.json +++ b/packages/compiler-core/package.json @@ -10,6 +10,7 @@ ], "types": "dist/compiler-core.d.ts", "buildOptions": { + "name": "VueCompilerCore", "formats": [ "esm-bundler", "cjs" diff --git a/packages/compiler-dom/package.json b/packages/compiler-dom/package.json index 30d69ae7..83c5c7c7 100644 --- a/packages/compiler-dom/package.json +++ b/packages/compiler-dom/package.json @@ -12,7 +12,7 @@ "unpkg": "dist/compiler-dom/global.js", "sideEffects": false, "buildOptions": { - "name": "VueDOMCompiler", + "name": "VueCompilerDOM", "formats": [ "esm-bundler", "cjs", diff --git a/packages/reactivity/package.json b/packages/reactivity/package.json index 9a6eec0a..1613b035 100644 --- a/packages/reactivity/package.json +++ b/packages/reactivity/package.json @@ -16,7 +16,7 @@ "url": "git+https://github.com/vuejs/vue.git" }, "buildOptions": { - "name": "VueObserver", + "name": "VueReactivity", "formats": [ "esm-bundler", "cjs", diff --git a/packages/runtime-core/package.json b/packages/runtime-core/package.json index deccfd3e..db5e28d0 100644 --- a/packages/runtime-core/package.json +++ b/packages/runtime-core/package.json @@ -10,6 +10,7 @@ ], "types": "dist/runtime-core.d.ts", "buildOptions": { + "name": "VueRuntimeCore", "formats": [ "esm-bundler", "cjs" diff --git a/packages/runtime-dom/package.json b/packages/runtime-dom/package.json index 6efbad1c..49e45f64 100644 --- a/packages/runtime-dom/package.json +++ b/packages/runtime-dom/package.json @@ -12,7 +12,7 @@ "unpkg": "dist/runtime-dom.global.js", "sideEffects": false, "buildOptions": { - "name": "VueDOMRuntime", + "name": "VueRuntimeDOM", "formats": [ "esm-bundler", "cjs", diff --git a/packages/runtime-test/package.json b/packages/runtime-test/package.json index 0a35d5ae..7ae947d2 100644 --- a/packages/runtime-test/package.json +++ b/packages/runtime-test/package.json @@ -15,7 +15,7 @@ "url": "git+https://github.com/vuejs/vue.git" }, "buildOptions": { - "name": "VueTestRuntime", + "name": "VueRuntimeTest", "formats": [ "global" ] diff --git a/rollup.config.js b/rollup.config.js index fb6f23d8..81971c33 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -135,7 +135,7 @@ function createReplacePlugin( isBrowserBuild, isRuntimeCompileBuild ) { - return replace({ + const replacements = { __COMMIT__: `"${process.env.COMMIT}"`, __VERSION__: `"${masterVersion}"`, __DEV__: isBundlerESMBuild @@ -155,7 +155,15 @@ function createReplacePlugin( // the lean build drops options related code with buildOptions.lean: true __FEATURE_OPTIONS__: !packageOptions.lean && !process.env.LEAN, __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) {