-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
'root-relative' urls are not resolved correctly #7
Comments
I think this issue may apply to other loaders that try to resolve paths from embedded urls as well, such as css-loader and less-loader. |
I think my expectation of how this would work is that the 'root-relative' urls would be resolved against the module root(s). Basically, instead of prepending with In fact, making the following change to function urlToRequire(url) {
if(/^~/.test(url))
return url.substring(1);
else if(/^\//.test(url))
return url.replace(/^\/+/, '');
else
return "./"+url;
} This also seems relevant to the similar functionality in css-loader. |
Mhmmm ... I'd expect absolute paths being resolved relative to resolve.root. |
I thought of a query parameter
|
Why is it a query parameter? Is it likely to have different roots? |
It doesn't seem very likely that there would be different roots for a given build, but it does seem likely that the root would need to be configured (and differently from |
Since #8 is now closed, i think this one can be closed, too! |
How does the root-query param work? |
K thx |
I'm having an issue with webpack failing to resolve a 'root-relative' url for a img src in an html file. When code looks something like (
/project/app/index.html
):webpack says:
ModuleNotFoundError: Module not found: Error: Cannot resolve file or directory .//app/assets/img.jpg in /project/app
The text was updated successfully, but these errors were encountered: