You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
? awaitmetaGlobComponents[componentPath]()// We need to call `await metaGlobComponents[componentPath]()` in development as it is `eager:false`
34
-
: metaGlobComponents[componentPath];// We need to directly access the `metaGlobComponents[componentPath]` expression in preview/production as it is `eager:true`
But you can also pass in additional options like [`import`](https://vitejs.dev/guide/features#named-imports), [`as`](https://vitejs.dev/guide/features#glob-import-as), or `eager`:
36
+
But you can also pass in additional options like [`import`](https://vitejs.dev/guide/features#named-imports), [`query`](https://vite.dev/guide/features.html#custom-queries):
The problem with `import.meta.glob` in Qwik, is that it currently either works in development and doesn't in preview/production, or it works in preview/production but gets slower and slower in development as the number of imported files increases.
48
-
49
-
The reason for this behavior, is that `import.meta.glob` with `eager.false` breaks the production bundle as it creates lazy-loadable chunks that Qwik doesn't know how to handle. On the other hand, `eager:true` seemingly fixes the issue as it allows Qwik to normally bundle the files, but it also slows down the development server - especially when you import a lot of heavy components with it.
50
-
51
-
As a workaround for now, you can use the build time `isDev` boolean from `"@builder.io/qwik"`:
0 commit comments