Bug report
What is the current behavior?
When requiring files using import.meta.webpackContext (added in #15446) that are located within a node_modules folder, eg:
const vuetify = import.meta.webpackContext('vuetify/lib/locale', {
recursive: false,
regExp: /(en|hu)\.js$/i,
});
It doesn't work properly and throws a warning during compilation
WARNING Compiled with 2 warnings 6:40:36 PM
warning in ./node_modules/vuetify/lib/locale/ ./node_modules/vuetify/lib/locale/ sync nonrecursive (en%7Chu)\.js$/
Module not found: Error: Can't resolve 'webpack-meta-bug/node_modules/vuetify/lib/locale/vuetify/lib/locale/en.js' in 'webpack-meta-bug'
It seems to be adding the context path twice to the request
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/Tofandel/webpack-meta-bug
Use the following webpack config
const path = require('path')
module.exports = {
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, './node_modules'),
]
},
}
And use import.meta.webpackContext('some_package_files')
What is the expected behavior?
It should require the files correctly
Other relevant information:
webpack version: 5.70.0
Node.js version: 16.13.1
Operating System: WSL2 - Ubuntu 20.04
Additional tools:
Bug report
What is the current behavior?
When requiring files using
import.meta.webpackContext(added in #15446) that are located within a node_modules folder, eg:It doesn't work properly and throws a warning during compilation
It seems to be adding the context path twice to the request
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/Tofandel/webpack-meta-bug
Use the following webpack config
And use
import.meta.webpackContext('some_package_files')What is the expected behavior?
It should require the files correctly
Other relevant information:
webpack version: 5.70.0
Node.js version: 16.13.1
Operating System: WSL2 - Ubuntu 20.04
Additional tools: