Debugging 将调试器附加到包裹生成应用程序
我的项目设置如下,在我的package.json中,我有以下内容:Debugging 将调试器附加到包裹生成应用程序,debugging,npm,webstorm,parceljs,Debugging,Npm,Webstorm,Parceljs,我的项目设置如下,在我的package.json中,我有以下内容: "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "parcel ./public/index.html --open", "build": "parcel build ./public/index.html NODE_ENV=production --no-source-maps --public-u
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "parcel ./public/index.html --open",
"build": "parcel build ./public/index.html NODE_ENV=production --no-source-maps --public-url ./public --out-dir ./dist",
"lint": "eslint --ext .js,.vue src --fix"
},
我可以通过运行以下命令启动我的项目:npm run:dev
,如下所示:
To debug the "dev" script, make sure the $NODE_DEBUG_OPTION string is specified as the first argument for the node command you'd like to debug.
For example:
"scripts": {
"start": "node $NODE_DEBUG_OPTION server.js"
}
> impcentral@1.0.0 dev /Users/william/imp/src/impCentral
> parcel ./public/index.html --open
Server running at http://localhost:63188 - configured port 1234 could not be used.
正如你所知道的,它不会在WebStorm中我的断点处停止。我尝试在package.json中传入$NODE\u DEBUG\u选项
,但没有效果
大家有什么想法吗,也可以在VisualStudio代码中尝试一下 除非需要调试包本身,否则不需要在调试器中运行NPM配置。由于您的应用程序(由parcel提供服务)在浏览器中运行,您必须使用运行配置对其进行调试
- 通过运行
(在WebStorm或终端中)启动应用程序npm run dev
- 使用服务器URL(,或在您的情况下)创建一个JavaScript调试运行配置:
- 选择此配置并按调试
dev
脚本不会退出,它会启动应用程序所在的服务器,并且必须运行它才能使应用程序正常工作。因此,您必须单独启动它,或者使用复合运行配置来同时启动npm脚本和Javascript调试运行配置