Tag:dva.jswebpack
Article From:https://segmentfault.com/q/1010000012143542
Question:

In JS, by using import to introduce pictures, if the picture is not converted to Base64, the picture will be transferred to the dist/static directory during the packaging process.

import titleImg from './images/title.png';

export default class Login extends Component {
    render() {
        return (<img src={titleImg} alt="The title "/>"}}

But the image path of this time should not be/static/title.ce51fdaf.png,And it should be./static/title.ce51fdaf.png

The site path is
|——index.html
|——static
|——|
|——|——title.ce51fdaf.png

This should be modified in the packaging configuration.

Answer 0:

webpackThe publicPath under output is configured as./xx
https://github.com/sorrycc/ro…

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *