标签:css app.js ref dev webp com inf ports styles
在项目中,使用npm run hot时,无法加载 http://localhost:8080/js/app.js 以及 http://localhost:8080/css/app.css
版本
引用时使用 mix() 方法
<link rel="stylesheet" href="{{ mix(‘css/app.css‘) }}">
<script src="{{ mix(‘js/app.js‘) }}"></script>
在webpack.config.js中,第324行的对象里面,加上
contentBase: "./public"
如下
module.exports.devServer = {
headers: {
"Access-Control-Allow-Origin": "*"
},
historyApiFallback: true,
noInfo: true,
compress: true,
quiet: true,
contentBase: "./public"
};
或者在mix的路径前面加上public
<link rel="stylesheet" href="{{ mix(‘public/css/app.css‘) }}">
<script src="{{ mix(‘public/js/app.js‘) }}"></script>
来源:https://github.com/JeffreyWay/laravel-mix/issues/830
@nickknissen
标签:css app.js ref dev webp com inf ports styles
原文地址:http://www.cnblogs.com/NKnife/p/7054628.html