Przeglądaj źródła

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

Evan You 6 lat temu
rodzic
commit
35858cec8c

+ 1 - 0
packages/compiler-core/package.json

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

+ 1 - 1
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",

+ 1 - 1
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",

+ 1 - 0
packages/runtime-core/package.json

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

+ 1 - 1
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",

+ 1 - 1
packages/runtime-test/package.json

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

+ 9 - 1
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) {