Skip to content

Commit

Permalink
fix: import element bundle (#297)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Dsaquel authored Jan 16, 2025
1 parent 9b13057 commit f395f8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"lint": "eslint --cache --max-warnings 0 .",
"lint:fix": "pnpm run lint --fix",
"typecheck": "vue-tsc --noEmit",
"release": "bumpp"
"release": "bumpp",
"format": "prettier --write --cache ."
},
"dependencies": {
"@unocss/reset": "^0.62.3",
Expand Down
7 changes: 5 additions & 2 deletions src/composables/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const useStore = (initial: Initial) => {
const pr =
new URLSearchParams(location.search).get('pr') ||
saved?._o?.styleSource?.split('-', 2)[1]
const prUrl = `https://preview-${pr}-element-plus.surge.sh/bundle/dist`

const versions = reactive<Versions>({
vue: 'latest',
elementPlus: pr ? 'preview' : 'latest',
Expand All @@ -55,9 +57,10 @@ export const useStore = (initial: Initial) => {
const userOptions: UserOptions = pr
? {
showHidden: true,
styleSource: `https://preview-${pr}-element-plus.surge.sh/bundle/index.css`,
styleSource: `${prUrl}/index.css`,
}
: {}

const hideFile = !IS_DEV && !userOptions.showHidden

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

0 comments on commit f395f8d

Please sign in to comment.