vue中path路径解析后变成\
2018-10-15 本文已影响0人
码农宋i
vue编译前
#app{background:url(../assets/logo.png)0center no-repeat;}
编译后
#app{background:url(static\img\logo.b5bb290.png)0center no-repeat;}
路径中/变为了\ (在windows下有问题 在mac下无此问题)
解决办法:在webpack中 将配置name路径更改
更改前: name: path.join(assetsPath, `images/[name].[hash:8].[ext]`)
更改后: name: path.posix.join(assetsPath, `images/[name].[hash:8].[ext]`)