-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
There is no way to pass a resource query when using context dependencies via require.context. In other words, this.resourceQuery will never be set inside a loader when using require.context.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
this.resourceQuery should be set in a loader for something like the following:
const ctx = require.context('images?foo=bar', false, /\.jpg$/);
ctx('./a.jpg');I have a test case and a proposed fix in my fork here - anuraaga#1
If the approach seems reasonable, I would be happy to move the PR to this repo for tweaks/submission, otherwise someone more familiar with the webpack design should probably take over as I just stumbled to that solution :)
If this is a feature request, what is motivation or use case for changing the behavior?
Some loaders (e.g. sharp-loader) use this.resourceQuery to enable certain behavior. This functionality cannot be used with context dependencies due to having no way to set a resource query. There doesn't seem to be any reason context dependencies should not support this feature as the only difference compared to a normal dependency is multiple files are resolved at the same time and placed in a map.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
All