npm i @babel/node
. ├── .babelrc ├── .vscode │ └── launch.json ├── package.json
<!--more-->node
關鍵點:shell
runtimeExecutable
, 用babel-node來debug"sourceMaps": true,
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "current file", "program": "${file}", "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node", "sourceMaps": true, "env": { "BABEL_ENV": "debug" } } ] }
說明:debug
對應launch.json中的 "BABEL_ENV": "debug"
npm
{ "presets": ["@babel/preset-env"], "env": { "debug": { "sourceMaps": "inline", "retainLines": true } } }
givencui博客首發, 轉載請註明來自GivenCuijson