Gulpfile
const elixir = require('laravel-elixir');
const gulp = require('gulp');
const watch = require('gulp-watch');
require('laravel-elixir-vueify');
require('laravel-elixir-vue-2')
function domix() {
elixir(mix => {
mix.copy('resources/assets/js/', 'public/js/');
mix.copy('resources/assets/css/', 'public/css/');
mix.copy('resources/assets/img/', 'public/img/');
mix.copy('resources/assets/fonts/', 'public/fonts/');
mix.browserify('resources/assets/js/app.js', 'public/js/app-vue.js')
});
}
gulp.task('watch', function() {
return watch('resources/assets/**/*.{js,css,vue}', domix);
});
gulp.task("default", domix);
domix();
我在控制台中看到的内容
[11:52:41] Starting 'copy'...
[11:52:41] Finished 'copy' after 82 ms
[11:52:41] Starting 'browserify'...
在最后一行之后它以100%的cpu使用率挂起。
如果我删除第mix.browserify('resources/assets/js/app.js', 'public/js/app-vue.js')
行,则效果正常。
app.js
import Vue from "vue"
import VueResource from 'vue-resource'
Vue.use(VueResource)
const infiniteScroll = require("vue-infinite-scroll");
Vue.use(infiniteScroll)
Vue.component("vue-log", require("./components/vue-log.vue"));
window.VueBus = new Vue();
Vue.http.headers.common['X-CSRF-TOKEN'] = document.querySelector('meta[name=csrf_token]').content;
const app = new Vue({
el: '#page-content'
});
如果我删除
Vue.component("vue-log", require("./components/vue-log.vue"));
browserify工作正常
组件非常简单
<template>
<div>
</div>
</template>
<script>
export default {
data() {
return {
currentPage: 1,
lastPage: 1
}
},
methods: {
loadNextPage() {
if(this.currentPage < this.lastPage) {
console.log("load next page " + this.currentPage + 1);
}
}
}
}
</script>
删除loadNextPage
方法的主体并进行编译。