run build 没有打包图片和字体文件
.loginModal { background: url("/src/assests/images/wallhaven.jpg") center center; }
图片路径换相对路径试试。
@sorrycc 我也遇到这种情况 ,换成相对路径 图片就访问不到了
build 后图片应该会统一被打到 dist 目录,怎么会访问不到呢? 路径问题? 详细点。
大神 http://react-china.org/t/less-webpack/4554 是webpack 配置问题
你没用 atool-build 做打包,而是自己写的 webpack.config.js ?
@johnsky123 你解决在 .less 文件中插件图片的问题了吗?应该怎么修改 webpack.config.js ?
云谦,打包之后图片路径不对啊,现在有解决方案了吗?打包前为相对路径,路径为 .welcome {background: url(../../assets/yay.jpg) no-repeat center 0;},打包后就为绝对路径了,路径为.welcome___12qxV{height:328px;background:url(/static/yay.44dd3333.jpg) no-repeat center 0;,就导致图片访问不到。这个问题能通过配置文件方式更改吗?
@fanerge 我之前也是 生成 css 都是直接 绝对路径/static的。 后来 我在.roadhogrc 是这么写
"publicPath":"../resource/",
"outputPath":"../resource/",
这样就能生生相对路径了
background: url(../resource/static/yay.44dd3333.jpg) no-repeat center 0;
好的,谢谢哈