You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
html-loader's require (when interpolate=require is set) ignores a loader (e.g. file-loader!) I specify as prefix.
Expected/desired behavior:
Same as using require normally (parse any loaders before require-ing a file).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
Given a HTML file with this:
<img src="${require('file-loader!./img.png')}">
Works with loader: 'html-loader?interpolate', fails with html-loader?interpolate=require - with the latter, ./ is prepended (I believe this is caused by loaderUtils.urlToRequest) and then webpack attempts to find ./file-loader!./img.png which fails (Module not found: Error: Can't resolve './file-loader').
What is the expected behavior? require behaving the same with interpolate and interpolate=require.
The text was updated successfully, but these errors were encountered:
I created a fix for this when using require and will be creating a pull request soon. I alias my directories so having it put a ./ there because problematic as nowhere else in my code am I doing ../../../.
I'm submitting a bug report
Webpack version:
3.7.1
HTML-Loader version:
0.4.5
Please tell us about your environment:
Linux
Current behavior:
html-loader's require (when
interpolate=require
is set) ignores a loader (e.g.file-loader!
) I specify as prefix.Expected/desired behavior:
Same as using
require
normally (parse any loaders beforerequire
-ing a file).Given a HTML file with this:
Works with
loader: 'html-loader?interpolate'
, fails withhtml-loader?interpolate=require
- with the latter,./
is prepended (I believe this is caused byloaderUtils.urlToRequest
) and then webpack attempts to find./file-loader!./img.png
which fails (Module not found: Error: Can't resolve './file-loader'
).require
behaving the same withinterpolate
andinterpolate=require
.The text was updated successfully, but these errors were encountered: