Repository navigation
{import.meta}.webpackContext is not a function #95274
Replies: 2 comments 1 reply
|
This is expected behavior with Turbopack right now. import.meta.webpackContext (and more broadly require.context) is a webpack-specific dynamic module resolution feature. Turbopack does not implement webpack’s module graph API, so these calls are not supported and will throw at runtime. ** Why this happens
** Current status As of now:
If you rely on context-based imports, you’ll need to replace it with one of these patterns:
|
|
Turbopack does not support Alternatives:
const modules = {
foo: () => import('./foo'),
bar: () => import('./bar'),
}
const modules = import.meta.glob('./*.ts')
If there's a specific use case that can only be solved with webpackContext, open a feature request - but the Turbopack team is focused on web standards, not replicating webpack internals. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
webpackContextdoes not seem to be supported. Will this in the future?, as turbopack tries to be backwards compatibleAll reactions