From 012e10c9ca13fcbc9bf67bf2835883edcd4faace Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 8 Jul 2022 11:42:36 +0800 Subject: [PATCH] fix(build): fix mjs dual package hazard close #12626 --- dist/vue.runtime.mjs | 75 ++++++++++++++++++++++++++++++++++++++++++++ scripts/config.js | 7 ----- src/v3/index.ts | 4 +++ 3 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 dist/vue.runtime.mjs diff --git a/dist/vue.runtime.mjs b/dist/vue.runtime.mjs new file mode 100644 index 00000000000..3ac875cdab6 --- /dev/null +++ b/dist/vue.runtime.mjs @@ -0,0 +1,75 @@ +import Vue from './vue.runtime.common.js' +export default Vue + +// this should be kept in sync with src/v3/index.ts +export const { + version, + + // refs + ref, + shallowRef, + isRef, + toRef, + toRefs, + unref, + proxyRefs, + customRef, + triggerRef, + computed, + + // reactive + reactive, + isReactive, + isReadonly, + isShallow, + isProxy, + shallowReactive, + markRaw, + toRaw, + readonly, + shallowReadonly, + + // watch + watch, + watchEffect, + watchPostEffect, + watchSyncEffect, + + // effectScope + effectScope, + onScopeDispose, + getCurrentScope, + + // provide / inject + provide, + inject, + + // lifecycle + onBeforeMount, + onMounted, + onBeforeUpdate, + onUpdated, + onUnmounted, + onErrorCaptured, + onActivated, + onDeactivated, + onServerPrefetch, + onRenderTracked, + onRenderTriggered, + + // v2 only + set, + del, + + // v3 compat + h, + getCurrentInstance, + useSlots, + useAttrs, + mergeDefaults, + nextTick, + useCssModule, + useCssVars, + defineComponent, + defineAsyncComponent +} = Vue diff --git a/scripts/config.js b/scripts/config.js index 851dc22971c..27a318499f9 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -71,13 +71,6 @@ const builds = { format: 'es', banner }, - // Runtime only ES modules build (for Node) - 'runtime-mjs': { - entry: resolve('web/entry-runtime-esm.ts'), - dest: resolve('dist/vue.runtime.mjs'), - format: 'es', - banner - }, // Runtime+compiler ES modules build (for bundlers) 'full-esm': { entry: resolve('web/entry-runtime-with-compiler-esm.ts'), diff --git a/src/v3/index.ts b/src/v3/index.ts index ec9d59e5444..30b89c3162e 100644 --- a/src/v3/index.ts +++ b/src/v3/index.ts @@ -1,3 +1,7 @@ +/** + * Note: also update dist/vue.runtime.mjs when adding new exports to this file. + */ + export const version: string = '__VERSION__' export {