From 92514db70821fce5aaa7dd903bfcb19252b26c4c Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 11 Jan 2024 18:04:32 +0800 Subject: [PATCH] build: add node production/development condition in package exports (#10036) follow up of #9977 --- packages/compiler-core/package.json | 14 ++++++++++++++ packages/compiler-dom/package.json | 14 ++++++++++++++ packages/compiler-sfc/package.json | 10 ++++++++++ packages/reactivity/package.json | 14 ++++++++++++++ packages/runtime-core/package.json | 14 ++++++++++++++ packages/runtime-dom/package.json | 14 ++++++++++++++ packages/server-renderer/package.json | 14 ++++++++++++++ packages/shared/package.json | 14 ++++++++++++++ packages/vue-compat/package.json | 14 ++++++++++++++ packages/vue/package.json | 5 +++++ 10 files changed, 127 insertions(+) diff --git a/packages/compiler-core/package.json b/packages/compiler-core/package.json index a5ff635918f..d5ef8b4d300 100644 --- a/packages/compiler-core/package.json +++ b/packages/compiler-core/package.json @@ -9,6 +9,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/compiler-core.d.ts", + "node": { + "production": "./dist/compiler-core.cjs.prod.js", + "development": "./dist/compiler-core.cjs.js", + "default": "./index.js" + }, + "module": "./dist/compiler-core.esm-bundler.js", + "import": "./dist/compiler-core.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "buildOptions": { "name": "VueCompilerCore", "compat": true, diff --git a/packages/compiler-dom/package.json b/packages/compiler-dom/package.json index 2e7206e14e1..bc7b9a8c65b 100644 --- a/packages/compiler-dom/package.json +++ b/packages/compiler-dom/package.json @@ -11,6 +11,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/compiler-dom.d.ts", + "node": { + "production": "./dist/compiler-dom.cjs.prod.js", + "development": "./dist/compiler-dom.cjs.js", + "default": "./index.js" + }, + "module": "./dist/compiler-dom.esm-bundler.js", + "import": "./dist/compiler-dom.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "sideEffects": false, "buildOptions": { "name": "VueCompilerDOM", diff --git a/packages/compiler-sfc/package.json b/packages/compiler-sfc/package.json index 21eda5a62cf..1c02868772e 100644 --- a/packages/compiler-sfc/package.json +++ b/packages/compiler-sfc/package.json @@ -8,6 +8,16 @@ "files": [ "dist" ], + "exports": { + ".": { + "types": "./dist/compiler-sfc.d.ts", + "node": "./dist/compiler-sfc.cjs.js", + "module": "./dist/compiler-sfc.esm-browser.js", + "import": "./dist/compiler-sfc.esm-browser.js", + "require": "./dist/compiler-sfc.cjs.js" + }, + "./*": "./*" + }, "buildOptions": { "name": "VueCompilerSFC", "formats": [ diff --git a/packages/reactivity/package.json b/packages/reactivity/package.json index 2f53964baf7..ed7928c1213 100644 --- a/packages/reactivity/package.json +++ b/packages/reactivity/package.json @@ -11,6 +11,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/reactivity.d.ts", + "node": { + "production": "./dist/reactivity.cjs.prod.js", + "development": "./dist/reactivity.cjs.js", + "default": "./index.js" + }, + "module": "./dist/reactivity.esm-bundler.js", + "import": "./dist/reactivity.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "sideEffects": false, "repository": { "type": "git", diff --git a/packages/runtime-core/package.json b/packages/runtime-core/package.json index 588adc20448..28a72a46e3f 100644 --- a/packages/runtime-core/package.json +++ b/packages/runtime-core/package.json @@ -9,6 +9,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/runtime-core.d.ts", + "node": { + "production": "./dist/runtime-core.cjs.prod.js", + "development": "./dist/runtime-core.cjs.js", + "default": "./index.js" + }, + "module": "./dist/runtime-core.esm-bundler.js", + "import": "./dist/runtime-core.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "buildOptions": { "name": "VueRuntimeCore", "formats": [ diff --git a/packages/runtime-dom/package.json b/packages/runtime-dom/package.json index f786057f38e..3c2d8e2e3ee 100644 --- a/packages/runtime-dom/package.json +++ b/packages/runtime-dom/package.json @@ -10,6 +10,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/runtime-dom.d.ts", + "node": { + "production": "./dist/runtime-dom.cjs.prod.js", + "development": "./dist/runtime-dom.cjs.js", + "default": "./index.js" + }, + "module": "./dist/runtime-dom.esm-bundler.js", + "import": "./dist/runtime-dom.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "sideEffects": false, "buildOptions": { "name": "VueRuntimeDOM", diff --git a/packages/server-renderer/package.json b/packages/server-renderer/package.json index 48e2458a553..3ff0817c694 100644 --- a/packages/server-renderer/package.json +++ b/packages/server-renderer/package.json @@ -9,6 +9,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/server-renderer.d.ts", + "node": { + "production": "./dist/server-renderer.cjs.prod.js", + "development": "./dist/server-renderer.cjs.js", + "default": "./index.js" + }, + "module": "./dist/server-renderer.esm-bundler.js", + "import": "./dist/server-renderer.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "buildOptions": { "name": "VueServerRenderer", "formats": [ diff --git a/packages/shared/package.json b/packages/shared/package.json index 0e19df2c95d..3e21d4a3b99 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -9,6 +9,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/shared.d.ts", + "node": { + "production": "./dist/shared.cjs.prod.js", + "development": "./dist/shared.cjs.js", + "default": "./index.js" + }, + "module": "./dist/shared.esm-bundler.js", + "import": "./dist/shared.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "sideEffects": false, "buildOptions": { "formats": [ diff --git a/packages/vue-compat/package.json b/packages/vue-compat/package.json index 4aa8e9d73ca..46d0bd9600e 100644 --- a/packages/vue-compat/package.json +++ b/packages/vue-compat/package.json @@ -10,6 +10,20 @@ "index.js", "dist" ], + "exports": { + ".": { + "types": "./dist/vue.d.ts", + "node": { + "production": "./dist/vue.cjs.prod.js", + "development": "./dist/vue.cjs.js", + "default": "./index.js" + }, + "module": "./dist/vue.esm-bundler.js", + "import": "./dist/vue.esm-bundler.js", + "require": "./index.js" + }, + "./*": "./*" + }, "buildOptions": { "name": "Vue", "filename": "vue", diff --git a/packages/vue/package.json b/packages/vue/package.json index 597c4acac95..a686179d48d 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -25,6 +25,11 @@ }, "require": { "types": "./dist/vue.d.ts", + "node": { + "production": "./dist/vue.cjs.prod.js", + "development": "./dist/vue.cjs.js", + "default": "./index.js" + }, "default": "./index.js" } },