diff --git a/packages/playground/ssr/yarn.lock b/packages/playground/ssr/yarn.lock index 53fcb60f64ad8244b6a085bb3aa6b1bfccc8a870..2a9082f5888d8ecbfa3351ab2f2baccf9f3abb1a 100644 --- a/packages/playground/ssr/yarn.lock +++ b/packages/playground/ssr/yarn.lock @@ -863,10 +863,10 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -esbuild@^0.9.3: - version "0.9.7" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.9.7.tgz#ea0d639cbe4b88ec25fbed4d6ff00c8d788ef70b" - integrity sha512-VtUf6aQ89VTmMLKrWHYG50uByMF4JQlVysb8dmg6cOgW8JnFCipmz7p+HNBl+RR3LLCuBxFGVauAe2wfnF9bLg== +esbuild@^0.11.19: + version "0.11.20" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.20.tgz#7cefa1aee8b372c184e42457885f7ce5d3e62a1e" + integrity sha512-QOZrVpN/Yz74xfat0H6euSgn3RnwLevY1mJTEXneukz1ln9qB+ieaerRMzSeETpz/UJWsBMzRVR/andBht5WKw== escalade@^3.1.1: version "3.1.1" @@ -2450,11 +2450,11 @@ verror@1.10.0: extsprintf "^1.2.0" vite@^2.2.3: - version "2.2.4" - resolved "https://registry.yarnpkg.com/vite/-/vite-2.2.4.tgz#8f9cc85aacab04c850085894b086c8717f12ed16" - integrity sha512-vnIwSNci+phFMp6krhy+FbYzKL0R67Sdt9mVZ96S27AewrApSJjTqncJcalk8sf60BgcbW4+1C6DFIWkxquO9g== + version "2.3.0" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.3.0.tgz#02b007c7aa4ac88cc18f854b9c68e4fbe76e3ef4" + integrity sha512-gsCy0t3X9nGGYDoNiE2NJgYq6BPxrtKeo6FkpMXdMvtUluYxnRhl7xfpHaYDmQLCnMbYTWhvWS1L/Hpw/V9L5w== dependencies: - esbuild "^0.9.3" + esbuild "^0.11.19" postcss "^8.2.1" resolve "^1.19.0" rollup "^2.38.5" diff --git a/packages/uni-h5-vue/dist/vue.runtime.cjs.js b/packages/uni-h5-vue/dist/vue.runtime.cjs.js index f8c171da55c348d325fbc927a7d958bcdb00fcab..3fbcca232fc5790d8cfd8ce89734dace6371f401 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.cjs.js +++ b/packages/uni-h5-vue/dist/vue.runtime.cjs.js @@ -9884,6 +9884,8 @@ exports.markRaw = markRaw; exports.mergeProps = mergeProps; exports.nextTick = nextTick; exports.onActivated = onActivated; +exports.onBeforeActivate = onBeforeActivate; +exports.onBeforeDeactivate = onBeforeDeactivate; exports.onBeforeMount = onBeforeMount; exports.onBeforeUnmount = onBeforeUnmount; exports.onBeforeUpdate = onBeforeUpdate; diff --git a/packages/uni-h5-vue/dist/vue.runtime.esm.js b/packages/uni-h5-vue/dist/vue.runtime.esm.js index fb5734b7332b711d5d6668dc0a33591682fc3aa1..003b5ab7490de62fe576a95d47f684cbbb35f75f 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.esm.js +++ b/packages/uni-h5-vue/dist/vue.runtime.esm.js @@ -9894,4 +9894,4 @@ const compile$1 = () => { } }; -export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId }; +export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeActivate, onBeforeDeactivate, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId }; diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index 6fc488848249103121e03d910b2ddb3272824f89..0d52fc7f5db92ce4599b7e49fb598b6e7c9c6f6e 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -1150,8 +1150,12 @@ function createRouterOptions() { }; } function initHistory() { + let {base} = __uniConfig.router; + if (base === "/") { + base = ""; + } { - return vueRouter.createMemoryHistory(__uniConfig.router.base); + return vueRouter.createMemoryHistory(base); } } var index$s = { diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 87290fa0b500b7eac66e6f243520fa97d09cc04b..a4dbdb3b94e39d41c52833acb613445d257a0663 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -4670,7 +4670,11 @@ function removeCurrentPages(delta = 1) { } } function initHistory() { - const history2 = __UNI_FEATURE_ROUTER_MODE__ === "history" ? createWebHistory(__uniConfig.router.base) : createWebHashHistory(__uniConfig.router.base); + let {base} = __uniConfig.router; + if (base === "/") { + base = ""; + } + const history2 = __UNI_FEATURE_ROUTER_MODE__ === "history" ? createWebHistory(base) : createWebHashHistory(base); history2.listen((_to, _from, info) => { if (info.direction === "back") { removeCurrentPages(Math.abs(info.delta)); diff --git a/packages/uni-h5/src/framework/plugin/router.ts b/packages/uni-h5/src/framework/plugin/router.ts index a5e1eecb8e681649a1822edde3e6eb00ccbca345..3675aa2219af6c19be75a9812ffceda3b8466dfe 100644 --- a/packages/uni-h5/src/framework/plugin/router.ts +++ b/packages/uni-h5/src/framework/plugin/router.ts @@ -45,13 +45,17 @@ function removeCurrentPages(delta: number = 1) { } function initHistory() { + let { base } = __uniConfig.router + if (base === '/') { + base = '' + } if (__NODE_JS__) { - return createMemoryHistory(__uniConfig.router.base) + return createMemoryHistory(base) } const history = __UNI_FEATURE_ROUTER_MODE__ === 'history' - ? createWebHistory(__uniConfig.router.base) - : createWebHashHistory(__uniConfig.router.base) + ? createWebHistory(base) + : createWebHashHistory(base) history.listen((_to, _from, info) => { if (info.direction === 'back') { removeCurrentPages(Math.abs(info.delta)) diff --git a/packages/vite-plugin-uni/src/config/build.ts b/packages/vite-plugin-uni/src/config/build.ts index a55b8a2552a592ad0874f5e0042f191a43c6c868..80a47881762f13a71ffa92885d558dcc5d57f5fd 100644 --- a/packages/vite-plugin-uni/src/config/build.ts +++ b/packages/vite-plugin-uni/src/config/build.ts @@ -2,15 +2,13 @@ import path from 'path' import slash from 'slash' import { UserConfig } from 'vite' import { VitePluginUniResolvedOptions } from '..' -import { FEATURE_DEFINES, initEasycomsOnce } from '../utils' +import { initEasycomsOnce } from '../utils' export function createBuild( - options: VitePluginUniResolvedOptions, - features: FEATURE_DEFINES + options: VitePluginUniResolvedOptions ): UserConfig['build'] { initEasycomsOnce(options.inputDir, options.platform) return { - polyfillDynamicImport: features.__UNI_FEATURE_PAGES__, rollupOptions: { output: { chunkFileNames(chunkInfo) { diff --git a/packages/vite-plugin-uni/src/config/index.ts b/packages/vite-plugin-uni/src/config/index.ts index 947e8695d1879f595962b8ada4f2afbf30af037d..bda6fd9616afa1b983b184b82fd358ca752e358b 100644 --- a/packages/vite-plugin-uni/src/config/index.ts +++ b/packages/vite-plugin-uni/src/config/index.ts @@ -11,7 +11,6 @@ import { createServer } from './server' import { createBuild } from './build' import { createOptimizeDeps } from './optimizeDeps' import { createDefine } from './define' -import { FEATURE_DEFINES } from '../utils' function normalizeRoot(config: UserConfig) { return normalizePath(config.root ? path.resolve(config.root) : process.cwd()) @@ -34,7 +33,7 @@ export function createConfig( resolve: createResolve(options, config), optimizeDeps: createOptimizeDeps(options), server: createServer(options), - build: createBuild(options, define as FEATURE_DEFINES), + build: createBuild(options), css: createCss(options), } }