Skip to content
Discussion options

You must be logged in to vote

That is expected, it is limitation of require.context, note - in ECMA modules I recommend to use

const req = import.meta.webpackContext('./mods', {
    recursive: true,
    regExp: /\.js$/
}); 

Unfortunately when using require.context and import.meta.webpackContext are always trying to resolve as a module, the PR was merged to support ContextReplacementPlugin,

Replies: 5 comments 2 replies

This comment was marked as disruptive content.

Comment options

You must be logged in to vote
0 replies

This comment has been hidden.

Comment options

You must be logged in to vote
0 replies
Answer selected by suguanYang
Comment options

You must be logged in to vote
2 replies
@suguanYang
Comment options

@alexander-akait
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #19204 on February 10, 2025 20:35.