前提・実現したいこと
Gulpを実行すると,うまくコンパイルはしてくれるが,正常にfinishしてくれない.
ソースコード
// パッケージをインストール import gulp from 'gulp'; import notify from 'gulp-notify'; import plumber from 'gulp-plumber'; import pug from 'gulp-pug'; import sass from 'gulp-sass'; import typescript from 'gulp-typescript'; //pug入力先、html出力先を記述 const paths = { src: { pug: "src/index.pug", scss: "src/scss/index.scss", ts: ["src/ts/index.ts"], }, public: { html: "public/", css: "public/css/", js: "public/js/", }, }; const pugOptions = { pretty: true, }; // pugコンパイル function conpilePug() { gulp.src(paths.src.pug) .pipe(plumber(notify.onError('Error: <%= error.message %>'))) .pipe(pug(pugOptions)) .pipe(gulp.dest(paths.public.html)); } // scssコンパイル function conpileScss() { gulp.src(paths.src.scss) .pipe(plumber(notify.onError('Error: <%= error.message %>'))) .pipe(sass(pugOptions)) .pipe(gulp.dest(paths.public.css)); } // typescriptコンパイル function conpileTypescript() { gulp.src(paths.src.ts) .pipe(plumber(notify.onError('Error: <%= error.message %>'))) .pipe(typescript({ target: "ES5", removeComments: true, sortOutput: true })) .pipe(gulp.dest(paths.public.js)); } gulp.task("default", function(){ gulp.watch(paths.src.pug, conpilePug()); gulp.watch(paths.src.scss, conpileScss()); gulp.watch(paths.src.ts, conpileTypescript()); });
発生している問題・エラーメッセージ
yarn run v1.21.1 $ /Library/WebServer/Documents/helloworld/node_modules/.bin/gulp [21:47:18] Requiring external module babel-register [21:47:18] Using gulpfile /Library/WebServer/Documents/helloworld/gulpfile.babel.js [21:47:18] Starting 'default'... gulp-typescript: sortOutput is deprecated - your project might work without it The non-standard option sortOutput has been removed as of gulp-typescript 3.0. Your project will probably compile without this option. Otherwise, if you're using gulp-concat, you should remove gulp-concat and use the outFile option instead. More information: http://dev.ivogabe.com/gulp-typescript-3/ [21:47:18] Finished 'default' after 14 ms src/ts/index.ts(2,12): error TS2370: A rest parameter must be of an array type. : : TypeScript: 16 semantic errors TypeScript: emit succeeded (with errors) [21:47:19] gulp-notify: [Error running Gulp] Error: TypeScript: Compilation failed ^C
わからないこと
こちらのソースコードはES6で記述しており,Babelを使用してES5への下位互換を適応して実行しております.
ネット上で調べながら書いてみたのですが,正常に実行が完了すると以下のスクリプトが帰ってきてプログラムが終了するはずなのですが,こちらの実行結果ではctr+Cを入力するまでプログラムが終了することはありません.(コンパイルは上手くできています)
どうすれば解決できるかわかりません.助言をいただけますか.お願いします.
Finished 'default' after 6.15 ms
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。