forked from opentiny/tiny-vue
parent
9e7008edef
commit
a07eeffee7
|
@ -5,5 +5,4 @@ VITE_TINY_THEME='saas'
|
||||||
# 官网应用类型:pc / mobile / mobile-first
|
# 官网应用类型:pc / mobile / mobile-first
|
||||||
VITE_APP_MODE='pc'
|
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_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_URL=/vue-saas-playground
|
||||||
VITE_PLAYGROUND_VERIOSN=${playgroudVersion}
|
|
|
@ -6,5 +6,4 @@ VITE_TINY_THEME='saas'
|
||||||
VITE_APP_MODE='pc'
|
VITE_APP_MODE='pc'
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/
|
VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/
|
||||||
VITE_PLAYGROUND_URL=/vue-saas-playground
|
VITE_PLAYGROUND_URL=/vue-saas-playground
|
||||||
VITE_PLAYGROUND_VERIOSN=${playgroudVersion}
|
|
|
@ -6,5 +6,4 @@ VITE_TINY_THEME='saas'
|
||||||
VITE_APP_MODE='pc'
|
VITE_APP_MODE='pc'
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/
|
VITE_APP_BUILD_BASE_URL=https://res.hc-cdn.com/tiny-vue-saas/${staticReleaseVersion}/
|
||||||
VITE_PLAYGROUND_URL=/vue-saas-playground
|
VITE_PLAYGROUND_URL=/vue-saas-playground
|
||||||
VITE_PLAYGROUND_VERIOSN=${playgroudVersion}
|
|
|
@ -35,9 +35,25 @@ const cdnHost = localStorage.getItem('setting-cdn')
|
||||||
const versionDelimiter = cdnHost.includes('npmmirror') ? '/' : '@'
|
const versionDelimiter = cdnHost.includes('npmmirror') ? '/' : '@'
|
||||||
const fileDelimiter = cdnHost.includes('npmmirror') ? 'files/' : ''
|
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 getRuntime = (version) => {
|
||||||
const useVersion = import.meta.env.VITE_PLAYGROUND_VERIOSN || version
|
if (isOldVersion(version)) {
|
||||||
return `${cdnHost}/@opentiny/vue-runtime${versionDelimiter}${useVersion}/${fileDelimiter}dist3/`
|
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) => {
|
const createImportMap = (version) => {
|
||||||
|
@ -45,7 +61,7 @@ const createImportMap = (version) => {
|
||||||
'vue': `${cdnHost}/vue${versionDelimiter}3.4.27/${fileDelimiter}dist/vue.runtime.esm-browser.js`,
|
'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`,
|
'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`,
|
'@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-icon': `${getRuntime(version)}tiny-vue-icon.mjs`,
|
||||||
'@opentiny/vue-locale': `${getRuntime(version)}tiny-vue-locale.mjs`,
|
'@opentiny/vue-locale': `${getRuntime(version)}tiny-vue-locale.mjs`,
|
||||||
'@opentiny/vue-common': `${getRuntime(version)}tiny-vue-common.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`
|
'sortablejs': `${cdnHost}/sortablejs${versionDelimiter}1.15.0/${fileDelimiter}modular/sortable.esm.js`
|
||||||
}
|
}
|
||||||
if (['aurora', 'smb', 'saas'].includes(tinyTheme)) {
|
if (['aurora', 'smb', 'saas'].includes(tinyTheme)) {
|
||||||
imports[`@opentiny/vue-design-${tinyTheme}`] =
|
imports[
|
||||||
`${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js`
|
`@opentiny/vue-design-${tinyTheme}`
|
||||||
|
] = `${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js`
|
||||||
}
|
}
|
||||||
if (isSaas) {
|
if (isSaas) {
|
||||||
imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
|
imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
|
||||||
|
|
Loading…
Reference in New Issue