service side use esm
to enabled ES6. To start with esm
, you should use the command node -r esm index.js
(npm start
), debug with esm
in vscode, you should have the launch.json file in the folder of .vscode
.
{
// 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": "Launch Program",
"program": "${workspaceFolder}/index.js",
"runtimeArgs": ["-r", "esm"]
}
]
}