Conversation
|
For maintainers only:
|
0fd43e0 to
2764e91
Compare
sokra
left a comment
There was a problem hiding this comment.
Best see lib/dependencies/ImportParserPlugin.js how all these options need to be handled.
705967f to
e6f9968
Compare
e6f9968 to
b89f397
Compare
| "webpack/lib/dependencies/ImportMetaContextDependency" | ||
| ); | ||
|
|
||
| ImportMetaContextDependency.Template = ModuleDependencyTemplateAsRequireId; |
|
|
||
| const handler = (parser, parserOptions) => { | ||
| if ( | ||
| parserOptions.importMetaContext !== undefined && |
There was a problem hiding this comment.
This option need to be added to the schema
|
I've created an issue to document this in webpack/webpack.js.org. |
|
There seems to be a bug when using it with a package const locales = import.meta.webpackContext('@/locales', {
recursive: false,
regExp: /(en|hu)\.json$/i,
});
const vuetify = import.meta.webpackContext('vuetify/lib/locale', {
recursive: false,
regExp: /(en|hu)\.js$/i,
});First one works perfect, second one throws warning during compilation It seems to be using the context twice |
|
@Tofandel Looks like yes, please open an issue, thanks |
|
Managed to get a minimal repro (funny enough only seems to happen with vue-cli, didn't happen with webpack-cli only) so something funny with the config is going on, so will open one |
|
Got it to reproduce without vue-cli Just adding this in the webpack config const path = require('path')
module.exports = {
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, './node_modules'),
]
},
} |
|
Also, not really a bug, but just exploring this without a doc I found that the default mode is |
yeah, need to add a warning if not |
What kind of change does this PR introduce?
feature
closes #15372
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
import.meta.webpackContext("directory", { recursive: boolean, regExp: RegExp, mode })returns same asrequire.contextbut only forjavascript/auto,javascript/esm