これまではtypescriptとsassファイルをビルドするためにgulpを使用しましたが、今やいくつかの新しいビルドステップのために、すべてを統一し、単一のエントリポイントとしてノードを使用したいと思います。 npm run taskNameを使用してgulpタスクを実行します)。ノードを持つVSコードとタスク
tasks.jsonは、タスクbuild
がnpm run watch
を実行する必要があり、非常に簡単です:
{
"version": "0.1.0",
"command": "npm",
"isShellCommand": true,
"tasks": [
{
"taskName": "build",
"isBuildCommand": true,
"showOutput": "always",
"isWatching": true,
"args": [
"run", "watch"
]
}
]
}
package.json
"scripts": {
"watch": "gulp default",
}
そして出力:出力に基づいて
gulp default build
[14:20:54] Using gulpfile PATH_TO/gulpfile.js
[14:20:54] Task 'build' is not in your gulpfile
[14:20:54] Please check the documentation for proper gulpfile formatting
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch" "build"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] watch: `gulp default build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] watch script 'gulp default build'.
npm ERR! This is most likely a problem with the 2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp default build
npm ERR! You can get their info via:
npm ERR! npm owner ls 2
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
、ああ、まだ何とか使用されているにもかかわらず、それの兆候がないと思ってもtasks.json
(gulpfile.json
がルートディレクトリに存在し、ソリューションを検索しているときに、VSコードが自動的にそれを検出したことが判明しました。これは問題の可能性がありますか?)。また、taskName
プロパティは、自動的にコマンドラインに間違った引数として追加されるような外観です。
小さいが、実施例(それはまだ救うため、typescriptですが、それぞれに二回コンパイルされがぶ飲みを実行します):私は、NPMを通じてVSコード内で複数のタスクを持つことができますどのように
{
"version": "0.1.0",
"command": "npm",
"isShellCommand": true,
"args": [
"run", "watch"
],
"showOutput": "always"
}
?あなたは基本的には次のように.vscode\tasks.json
作成するように指示するthis articleを探し、VSコードからNPMスクリプトタスクを実行するために探しているなら、私のコメントで述べたように
同様の解決策も探しています。コマンドラインに追加されたtaskNameに関しては、「suppressTaskName」の設定プロパティを参照してください。[here](http://scottaddie.com/2015/10/07/harnessing-webpack-with-visual-studio-code/) – superjos
また、 、VSコード – superjos