diff --git a/examples/sites/env/.env.innersaas b/examples/sites/env/.env.innersaas index d585c92d4..22303db3c 100644 --- a/examples/sites/env/.env.innersaas +++ b/examples/sites/env/.env.innersaas @@ -5,5 +5,4 @@ VITE_TINY_THEME='saas' # 官网应用类型:pc / mobile / mobile-first VITE_APP_MODE='pc' VITE_APP_BUILD_BASE_URL=https://test-static-resource.obs.cn-north-7.ulanqab.huawei.com/tiny-vue-saas/${staticReleaseVersion}/ -VITE_PLAYGROUND_URL=/vue-saas-playground -VITE_PLAYGROUND_VERIOSN=${playgroudVersion} \ No newline at end of file +VITE_PLAYGROUND_URL=/vue-saas-playground \ No newline at end of file diff --git a/examples/sites/env/.env.saasopen b/examples/sites/env/.env.saasopen index 4179297ff..903f697e1 100644 --- a/examples/sites/env/.env.saasopen +++ b/examples/sites/env/.env.saasopen @@ -6,5 +6,4 @@ VITE_TINY_THEME='saas' VITE_APP_MODE='pc' VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/ -VITE_PLAYGROUND_URL=/vue-saas-playground -VITE_PLAYGROUND_VERIOSN=${playgroudVersion} \ No newline at end of file +VITE_PLAYGROUND_URL=/vue-saas-playground \ No newline at end of file diff --git a/examples/sites/env/.env.saasprod b/examples/sites/env/.env.saasprod index 2d25dabe0..5fb116cab 100644 --- a/examples/sites/env/.env.saasprod +++ b/examples/sites/env/.env.saasprod @@ -6,5 +6,4 @@ VITE_TINY_THEME='saas' VITE_APP_MODE='pc' VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/ -VITE_PLAYGROUND_URL=/vue-saas-playground -VITE_PLAYGROUND_VERIOSN=${playgroudVersion} \ No newline at end of file +VITE_PLAYGROUND_URL=/vue-saas-playground \ No newline at end of file diff --git a/examples/sites/playground/App.vue b/examples/sites/playground/App.vue index 40bd9665d..4aad46831 100644 --- a/examples/sites/playground/App.vue +++ b/examples/sites/playground/App.vue @@ -35,9 +35,25 @@ const cdnHost = localStorage.getItem('setting-cdn') const versionDelimiter = cdnHost.includes('npmmirror') ? '/' : '@' const fileDelimiter = cdnHost.includes('npmmirror') ? 'files/' : '' +const isOldVersion = (version) => { + const minorVersion = version?.split('.')?.[1] + return minorVersion && minorVersion < 16 +} + +// 3.16.0版本之前的runtime还没有抽离单独的包 const getRuntime = (version) => { - const useVersion = import.meta.env.VITE_PLAYGROUND_VERIOSN || version - return `${cdnHost}/@opentiny/vue-runtime${versionDelimiter}${useVersion}/${fileDelimiter}dist3/` + if (isOldVersion(version)) { + return `${cdnHost}/@opentiny/vue${versionDelimiter}${version}/${fileDelimiter}runtime/` + } + return `${cdnHost}/@opentiny/vue-runtime${versionDelimiter}${version}/${fileDelimiter}dist3/` +} + +// 3.16.0版本之前的runtime没有tiny-vue-pc.mjs文件 +const getPcRuntime = (version) => { + if (isOldVersion(version)) { + return `${getRuntime(version)}tiny-vue.mjs` + } + return `${getRuntime(version)}tiny-vue-pc.mjs` } const createImportMap = (version) => { @@ -45,7 +61,7 @@ const createImportMap = (version) => { 'vue': `${cdnHost}/vue${versionDelimiter}3.4.27/${fileDelimiter}dist/vue.runtime.esm-browser.js`, 'echarts': `${cdnHost}/echarts${versionDelimiter}5.4.1/${fileDelimiter}dist/echarts.esm.js`, '@vue/compiler-sfc': `${cdnHost}/@vue/compiler-sfc${versionDelimiter}3.4.27/${fileDelimiter}dist/compiler-sfc.esm-browser.js`, - '@opentiny/vue': `${getRuntime(version)}tiny-vue-pc.mjs`, + '@opentiny/vue': getPcRuntime(version), '@opentiny/vue-icon': `${getRuntime(version)}tiny-vue-icon.mjs`, '@opentiny/vue-locale': `${getRuntime(version)}tiny-vue-locale.mjs`, '@opentiny/vue-common': `${getRuntime(version)}tiny-vue-common.mjs`, @@ -56,8 +72,9 @@ const createImportMap = (version) => { 'sortablejs': `${cdnHost}/sortablejs${versionDelimiter}1.15.0/${fileDelimiter}modular/sortable.esm.js` } if (['aurora', 'smb', 'saas'].includes(tinyTheme)) { - imports[`@opentiny/vue-design-${tinyTheme}`] = - `${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js` + imports[ + `@opentiny/vue-design-${tinyTheme}` + ] = `${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js` } if (isSaas) { imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`