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
webpack alias does not work with src="something" #185
Comments
I think you need to prefix the src with "~", see vuejs/vue-loader#193 |
nope. '~/something' will become '/something' without the alias being applied |
Strange, it works for me resolve: {
alias: {
'@app': path.join(config.dir, './app')
}
} <img src="~@app/images/logo.png"> |
i'm loading the html like so. import template from "./device_details.html";
console.log(template); module: {
rules: [
{
test: /\.html$/,
use: [
'html-loader',
]
},
]
} |
I can't get this to work in Angular. I found documentation about it in the vue-loader but no code to support the behavior, so I'm not sure how they implemented it. I of course don't use vue-loader since I am using Angular, but it makes me wonder if html-loader has this functionality but it's not documented? (Or I can't find it.) |
Example above #185 (comment) |
I still meet this problem in webpack5, my alias config is resolve: {
modules: ['node_modules', path.resolve(__dirname, '../src')],
extensions: ['.js', '.json'],
alias: {
'@': path.resolve(__dirname, '../src'),
},
}, And i use ejs-template-loader with <img src="@/images/logo.svg"> which cause the error
If I change the image path to |
|
Webpack version:
HTML-Loader version:
Please tell us about your environment:
Current behavior:
Expected/desired behavior:
alias should be applied before resolving
The text was updated successfully, but these errors were encountered: