编译资产时
import './bootstrap';
import './components';
const app = new Vue({
el: '#app'
});
这是我的package.json文件
{
"private": true,
"scripts": {
"dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies":
{
"axios": "^0.16.2",
"bootstrap-sass": "^3.3.7",
"jquery": "^3.2.1",
"laravel-mix": "^1.4.3",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vue2-google-maps": "^0.8.4"
}
}
Case.vue
<template>
<div>
<ul class="collection">
<li></li>
</ul>
</div>
</template>
<script>
</script>
<style lang="css" scoped>
</style>
我认为laravel mix已经关注了webpack配置。这个错误,我记得在webpack中处理style-loader。但为什么它存在于laravle-mix
中答案 0 :(得分:0)
我认为您需要将此脚本添加到 index.blade.php
<script src="{{ asset('/js/app.js') }}"></script>
使用此方法,您可以在laravel-Mix中编译资产
希望这是解决您问题的方法。