Skip to content

Commit

Permalink
fix: hook load add condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jevon617 committed Feb 16, 2023
1 parent 80d31e4 commit 59132cb
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 15 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"local-pkg": "^0.4.2",
"svg-baker": "^1.7.0",
"svgo": "^2.8.0",
"unplugin": "^0.9.6"
"unplugin": "^0.9.6",
"unplugin-svg-component": "workspace:0.4.3"
},
"devDependencies": {
"@antfu/eslint-config": "^0.27.0",
Expand Down
62 changes: 53 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ const unplugin = createUnplugin<Options>(options => ({
}
},
vite: {
async load(_, ssr) {
if (ssr?.ssr)
return null
return {
code: moduleCode,
async load(id, ssr) {
if (id === MODULE_NAME) {
if (ssr?.ssr)
return null
return {
code: moduleCode,
}
}
},
transform(this) {
Expand Down

0 comments on commit 59132cb

Please sign in to comment.