webpack.config.js
var webpack = require("webpack");
module.exports = {
entry : {
index : __dirname+"/src/index.js"
},
output : {
path : __dirname+"/build",
publicPath: '/assets/',
filename : "bundle.js"
},
module : {
loaders : [
{
test : /.vue$/,
loader: 'vue-loader'
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=8192&name=images/[hash:8].[name].[ext]'
},
{
test: /\.html$/,
loader: 'html-withimg-loader'
}
]
},
resolve: {
alias: {
'vue': 'vue/dist/vue.js'
}
}
}
search.vue
<template>
<div class="search">
<h1><img src="assets/logo.jpg" /></h1>
</div>
</template>
<script>
</script>
<style lang="scss">
$nav-color: #F90;
nav {
background:url("assets/logo.jpg") no-repeat;
$width: 100px;
width: $width;
color: $nav-color;
}
</style>
not found 没有找到这个图片资源,请确认你的资源存在与否或者路径是否正确。