Skip to content

Commit e18f021

Browse files
committed
chore: wip
1 parent b22f1f9 commit e18f021

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

storage/framework/core/vite-config/src/views.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ console.log('views.ts')
2828
const config: UserConfig = defineConfig({
2929
build: {
3030
rollupOptions: {
31-
external: ['fsevents', 'tinyexec', '@iconify/utils', '@antfu/install-pkg', 'local-pkg', 'mlly', 'fs'],
31+
external: ['fsevents', 'tinyexec', '@iconify/utils', '@antfu/install-pkg', 'local-pkg', 'mlly', 'fs', 'bun'],
3232
},
3333
},
3434

@@ -40,7 +40,7 @@ const config: UserConfig = defineConfig({
4040
assetsInclude: [p.publicPath('**'), p.resourcesPath('assets/*'), p.resourcesPath('assets/**/*')],
4141

4242
optimizeDeps: {
43-
exclude: ['vue'],
43+
exclude: ['vue', 'bun'],
4444
},
4545

4646
server: server({

storage/framework/views/web/src/main.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,28 @@ export const createApp = ViteSSG(
1414
base: import.meta.env.BASE_URL,
1515
},
1616
(ctx) => {
17-
// install all modules under `modules/`
18-
;(async () => {
19-
const modules = import.meta.glob<{ install: UserModule }>('../../../../../resources/modules/*.ts')
20-
const promises = Object.values(modules).map((func) => func())
21-
const modulesArray = await Promise.all(promises)
22-
for (const module of modulesArray) module.install?.(ctx)
23-
})()
17+
if (!ctx.isClient) {
18+
// install all modules under `modules/`
19+
;(async () => {
20+
const glob = new Bun.Glob('**/*.ts')
21+
const moduleFiles = []
22+
for await (const file of glob.scan('../../../../../resources/modules')) {
23+
moduleFiles.push(file)
24+
}
25+
26+
// const modules = import.meta.glob<{ install: UserModule }>('../../../../../resources/modules/*.ts')
27+
// const promises = Object.values(modules).map((func) => func())
28+
// const modulesArray = await Promise.all(promises)
29+
30+
const modulesArray = await Promise.all(
31+
moduleFiles.map(async (file) => {
32+
const module = await import(/* @vite-ignore */ file)
33+
return module
34+
}),
35+
)
36+
37+
for (const module of modulesArray) module.install?.(ctx)
38+
})()
39+
}
2440
},
2541
)

0 commit comments

Comments
 (0)