Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
If you are building on Webpack, and the picture is in src/img/image.svg
And the output folder is dist/
webpack.config in modules
{
test: /\.(png|svg|jpg|gif)$/,
use: [{
loader: 'file-loader',
options: {
name: f => {
let dirNameInsideAssets = path.relative(path.join(__dirname, 'src'), path.dirname(f));
return `${dirNameInsideAssets}/[name].[ext]`;
}
}
}],
},
import "./img/image.svg";
<img src="img/image.svg" alt=""/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question