Skip to content

Commit f395f8d

Browse files
authored
fix: import element bundle (#297)
* fix: import whole build bundle from pr * fix: import build bundle if exist * chore: refact * chore: add comment * chore: use pr number * chore: remove check pr number
1 parent 9b13057 commit f395f8d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"lint": "eslint --cache --max-warnings 0 .",
1919
"lint:fix": "pnpm run lint --fix",
2020
"typecheck": "vue-tsc --noEmit",
21-
"release": "bumpp"
21+
"release": "bumpp",
22+
"format": "prettier --write --cache ."
2223
},
2324
"dependencies": {
2425
"@unocss/reset": "^0.62.3",

src/composables/store.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const useStore = (initial: Initial) => {
4747
const pr =
4848
new URLSearchParams(location.search).get('pr') ||
4949
saved?._o?.styleSource?.split('-', 2)[1]
50+
const prUrl = `https://preview-${pr}-element-plus.surge.sh/bundle/dist`
51+
5052
const versions = reactive<Versions>({
5153
vue: 'latest',
5254
elementPlus: pr ? 'preview' : 'latest',
@@ -55,9 +57,10 @@ export const useStore = (initial: Initial) => {
5557
const userOptions: UserOptions = pr
5658
? {
5759
showHidden: true,
58-
styleSource: `https://preview-${pr}-element-plus.surge.sh/bundle/index.css`,
60+
styleSource: `${prUrl}/index.css`,
5961
}
6062
: {}
63+
6164
const hideFile = !IS_DEV && !userOptions.showHidden
6265

6366
const [nightly, toggleNightly] = useToggle(false)
@@ -66,7 +69,7 @@ export const useStore = (initial: Initial) => {
6669
if (pr)
6770
importMap = mergeImportMap(importMap, {
6871
imports: {
69-
'element-plus': `https://preview-${pr}-element-plus.surge.sh/bundle/index.full.min.mjs`,
72+
'element-plus': `${prUrl}/index.full.min.mjs`,
7073
'element-plus/': 'unsupported',
7174
},
7275
})

0 commit comments

Comments
 (0)