New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import.meta.webpackContext doesn't work if requiring inside npm packages #15580
Comments
Issue is happening there |
lets keep issue for now.. need to fix this anyway.. |
There is a fix #15581 ... It passes tests but the pipeline doesn't want to run on the PR As for removing duplicate resolve.modules, that's the default of vue-cli, so not really an option given that the bug is indeed here, that was the whole point of this issue and fix in the first place, which took me hours to track down so I can imagine future users trying to use this in a vue project only to find the same bug, only to find after 2hours of debug and searching issues that the only workaround is to do chainWebpack: config => {
config.resolve.modules.delete('node_modules');
} The problem is the resolution adds an item like When it should be Or
|
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:
The text was updated successfully, but these errors were encountered: