In my vue (2.0) + webpack project, I configure vue-html-loader, but in my .vue files, the img tag cannot load static src images. Below is my webpack configurator:
module: { loaders: [ ... { test: /\.html$/, exclude: /node_modules/, loaders: ['html', 'html-minify'] } , { test: /\.vue$/, loader: 'vue' } ... ] }, vue: { ... html: { root: path.resolve(__dirname, './source/static'), attrs: ['img:src', 'img:srcset'] }, loaders: { css: ExtractTextPlugin.extract("css"), sass: ExtractTextPlugin.extract("css!sass") } }, resolve: { root: [ path.resolve('./source') ], extensions: ['', '.js', '.json', '.scss', '.html', '.css', '.vue'], alias: { 'vue': 'vue/dist/vue.js' } },
Below is my .vue file:
<img src="/web/img/ sieleLogo@1x.png " srcset="/web/img/ sieleLogo@2x.png " />
My browser always gives a 404 error. Has someone got the same problem?
source share