-
Notifications
You must be signed in to change notification settings - Fork 24
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
Possible to have image paths resolved using webpack's resolve.alias? #20
Comments
Hi. Replacing paths with elements in the resolve object is not yet a feature of this loader. For now, paths must be relative to the corresponding image. I'll look into this subject bacause it could be interesting to have. |
I have such webpack resolve config section defined
I then do including
So aliases have not taken into account and unfortunately it makes |
Just to let you guys know: I'm actually working on this. The main problem here is that webpack doesn't provide a straightforward way to obtain the current configuration file. This is currently the implementation of the module.exports = {
require: function (resourcePath) {
return "require(" + JSON.stringify(loaderUtils.urlToRequest(resourcePath)) + ").apply(null,arguments)";
},
//...
}; As you may already figured out, there's no smart postprocessing here. If there's an alias defined in your configuration file, the loader will just ignore it. |
Have you tried using the <img src="~images/something.png" /> This works for us. We're using Webpack 2. |
@dmackerman Didn't work for me in the |
It doesn't look like this is currently supported by the loader, but please correct me if I'm wrong!
In my webpack.config.js
https://webpack.github.io/docs/configuration.html#resolve-alias
I'm aliasing
core
to a path, so I can have shorter friendlier paths to thecore
across my application, this works fine in myjs
files.As it stands my images still need relative paths, to reference common assets in the
core
:If the
resolve.alias
were factored into path resolving, this could been simplified to:Would this be possible?
The text was updated successfully, but these errors were encountered: