Using V3 of this library in TS breaks debug in Intelli J
rehanvdm opened this issue · comments
Steps to reproduce
Install the latest V3 package in a TS project and place a break point.
Expected behaviour
The break point must be hit.
Actual behaviour
The breakpoint is not hit.
Additional details
If I downgrade to V2 then it works, the breakpoint is hit. It is as if the V3 package breaks the debug of Intelli J completely. I can not place breakpoints and hit them at all then. I am using ES Build to transpile the TS to JS. Here is the function (as is) and config for that.
export async function esBuildLambda(srcDir: string, distDir: string, fileNameNoExtension: string)
{
let pathTs = path.join(srcDir, fileNameNoExtension +".ts");
let pathJs = path.join(distDir, fileNameNoExtension +".js");
console.time("** ES BUILD");
let result = await esbuild.build({
// minify: true, //saves about 10% // Screws with break points, misses some and sometimes stops wrong lines
logLevel: "error",
bundle: true,
target: ["node14"],
keepNames: false,
entryPoints: [pathTs],
platform: 'node',
sourcemap: 'inline',
loader: {
'.yaml': 'text',
},
external: [
// Known Caveat: pg-native is not available and won't be used. This is letting the
// bundler (esbuild) know pg-native won't be included in the bundled JS file.
'pg-native',
],
outfile: pathJs,
});
console.timeEnd("** ES BUILD");
}
The main difference between V2 and V3 that I can see that might make a difference is that V3 exports and declares .mjs files whereas V2 is only CJS.
Thank you for submitting an issue, I'll try to help.
Can you please share, where are you placing the breakpoint? What is the file path and line?
Placing the break point on the TS file. That has contents like this:
import isbot from 'isbot'
...
const itsaBot = isbot(apiInput.ua);
I even tried to import the direct JS files like this
import isbot from '../../../../../../../../node_modules/isbot/index.mjs';
OR
import isbot from '../../../../../../../../node_modules/isbot/index.js';
Both still break debugging.
PhpStorm 2022.2.1 which is released around August.
I don't see an easyway for you to fix and debug this :/ its also not to priority I guess living with V2 is good enough for now 🤷♂️
If you want to close it, it's fine, I will live with V2 for now :) Thank you for your OS contribution and this library 🤲
I'm pretty confident that version 4 will not have these issues. It is the "next" version.
It is built as Typescript and changes default export to named export
npm i isbot@4
import { isbot } from "isbot";
Thanks :)