Skip to content

Commit

Permalink
fix: ignore falsy module.default
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed May 22, 2023
1 parent 1227b40 commit d516ec2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/vite/src/modules/1.foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("foo")
1 change: 1 addition & 0 deletions examples/vite/src/modules/2.bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("bar")
1 change: 0 additions & 1 deletion examples/vite/src/modules/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { App } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
Expand Down
4 changes: 4 additions & 0 deletions src/shared/virtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export const modules = ${await createVirtualGlob(glob)}
export const useModules = app => {
Object.values(modules).forEach(module => {
if (!module.default) {
return
}
if (typeof module.default === 'function') {
module.default(app)
}
Expand Down

0 comments on commit d516ec2

Please sign in to comment.