Gulp手表变化无法正常工作

时间:2017-03-28 14:57:20

标签: javascript npm gulp laravel-5.4 gulp-watch

我创建了gulpfile.js并将其放入js文件中,这将是gulp .. 主要问题是... gulp不能在js文件中的每个更改中工作 component.vue中的任何更改都没有在运行时显示!!但是第一次运行gulp时显示int! 为什么?

webpack.config.js

module.exports = {

entry: './resources/assets/js/accountvue.js',
output: {
    filename: 'app.js'
},
devtool: 'source-map',
resolve: {
    alias: {
        'vue$': 'vue/dist/vue.js'
    }
},
module: {
    loaders: [
        {
            test: /\.js$/,
            loader: 'babel',
            exclude: /node_modules/,
            query: {
                "presets": ["es2015"],
                // "plugins": ["transform-runtime"],
                "comments": false
            }
        },
        {
            test: /\.vue$/,
            loader: 'vue'
        }
    ]
}
};

gulpfile.js

var elixir = require('laravel-elixir');

var gulp       = require('gulp'),
webpack    = require('webpack-stream'),
watch = require('gulp-watch');

gulp.task('script', () => {

"use strict";

return gulp.src('./resources/assets/js/accountvue.js')
    .pipe(webpack(require('./webpack.config.js')))
    .pipe(gulp.dest('./public/js/'));

});

gulp.task('watch', function(){
 gulp.watch('./resources/assets/js/accountvue.js',['script']);
});

gulp.task('default', ['script','watch']);

0 个答案:

没有答案