2016-11-28 20 views
0

Vueルーターから始まり、始動に続いてすぐに問題が発生しています。私はガルプは、ファイルを保存するときには、私の端末でこのエラーをスローランニングを見ていVueルーター:Gulp uglify/watch nodeエラー

const Home = { template: '<div>Home</div>' } 

const routes = [ 
    { path: '/', component: Home } 
] 

const router = new VueRouter({ 
    routes // short for routes: routes 
}) 

const app = new Vue({ 
    router 
}).$mount('#app') 

:例と同じコードを使用して

events.js:160 
    throw er; // Unhandled 'error' event 
^
Error 
at new JS_Parse_Error (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18) 
at js_error (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11) 
at croak (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2092:9) 
at token_error (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2100:9) 
at expect_token (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2113:9) 
at expect (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2116:36) 
at eval (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2689:13) 
at eval (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2139:24) 
at expr_atom (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2619:35) 
at maybe_unary (eval at <anonymous> (/Users/dev/Desktop/clients/ms-photography/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2795:19) 

これはの私の時計のコードですgulpfile:

gulp.task('scripts', function() { 
    return gulp.src('wp-content/themes/ms-photography/src/js/*.js') 
    .pipe(minify()) 
    .pipe(gulp.dest('wp-content/themes/ms-photography/dist/js/')) 
    .pipe(livereload()); 
}); 

私はスクリプトをコンパイルしないとうまくいきます...アイデアはありますか?私はあなたのパイプラインにゴクゴク-バベルを追加する必要が想像

答えて

1

、その後、すなわち

npm install --save-dev gulp-babel babel-preset-es2015 

gulp.task('scripts', function() { 
    return gulp.src('wp-content/themes/ms-photography/src/js/*.js') 
    .pipe(babel({ 
     presets: ['es2015'] 
    })) 
    .pipe(minify()) 
    .pipe(gulp.dest('wp-content/themes/ms-photography/dist/js/')) 
    .pipe(livereload()); 
}); 
関連する問題