Currently, I'm in the process of constructing a monorepo using lerna and typescript. To get started, I'm utilizing this repository as a foundation: https://github.com/Izhaki/mono.ts
My main objective is to debug the code within Visual Studio Code. I attempted to incorporate a launch.json
setup like so:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug",
"preLaunchTask": "npm: build",
"program": "${workspaceFolder}/packages/line/src/index.ts",
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceFolder}/packages/line/dist/**/*.js"
]
}
]
}
Unfortunately, I encountered an error related to importing and using:
/Users/davidericci/Desktop/mono.ts-master/packages/line/dist/index.js:1
(function (exports, require, module, __filename, __dirname) { import { getDistance } from '@geo/point';
^
SyntaxError: Unexpected token {
To address this, I made adjustments within the tsconfig.build.json
file (located inside packages):
"target": "es2017",
"module": "commonjs",
And similarly, within the tsconfig.base.json
file (also found within packages):
{
"compilerOptions": {
"lib": ["es2015", "es2016", "dom", "es2017", "es6", "es5"],
"noUnusedLocals": true
}
}
However, the issue persists with the error message:
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '@geo/point'
This could be due to the fact that even within the JavaScript code, the import still references the TypeScript. It's possible my understanding is incorrect here.
Everything else remains at default settings for the project.
Could it be something related to tsconfig-paths
? Or perhaps there's a specific setting within the launch.json file that needs adjusting?
Thank you all for your assistance!