Webpack is not copying images to dist folder

旧巷老猫 提交于 2019-12-01 06:28:28

If your images are only referenced in HTML files as <img> tags, webpack by default won't pick them up because it doesn't parse HTML. You have at least 2 choices:

  1. Use CopyWebpackPlugin to copy the files to wherever you want, this at least removes the "manual" part you mention

  2. Move your images references to styles, where webpack can pick them up via the scss loader you are using. For example

    background-image: url("img/foo.png");
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!