【发布时间】:2019-11-18 14:03:05
【问题描述】:
编辑:我不想为此使用 grunt 或 gulp,也不想配置 parcel-bundler。我以前都用过 我想尝试为此使用 vscode 任务。
我有一个有效的 parcel watch npm 任务将我的文件构建到 dist 文件夹中。由于某些原因,我需要在每次构建后将文件从 dist 文件夹复制到另一个文件夹。我为此配置了另一个 npm 任务,称为“复制”。
我现在正在尝试配置一个 vscode 任务,以便在每次从 watch 任务构建之后运行这个“复制”任务。
我已经为此配置了一个监视任务,但是,当我使用 ctrl-c 终止监视任务时,它只会运行“复制”任务。
{
"version": "2.0.0",
"tasks": [
{
"label": "copy",
"type": "npm",
"script": "windows-build",
"path": "frontend/",
"problemMatcher": []
},
{
"label": "watch",
"type": "npm",
"script": "watch",
"path": "frontend/",
"isBackground": true,
"problemMatcher": {
"background": {
"activeOnStart": true,
"beginsPattern": "> parcel watch \\.\\/src\\/index\\.html --public-url \\/public\\/dist -d \\.\\.\\/public\\/dist",
"endsPattern": "√ Built in \\d+\\.\\d+s\\."
}
}
},
{
"label": "build",
"dependsOrder": "sequence",
"dependsOn":["watch","copy"]
}
]
}
我在“输出”选项卡中收到此错误消息
Error: the description can't be converted into a problem matcher:
{
"background": {
"activeOnStart": true,
"beginsPattern": "> parcel watch \\.\\/src\\/index\\.html --public-url \\/public\\/dist -d \\.\\.\\/public\\/dist",
"endsPattern": "√ Built in \\d+\\.\\d+s\\."
}
}
不知道为什么。感谢您提前提供任何帮助。
【问题讨论】:
标签: javascript build watch parceljs vscode-tasks