vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Switch to use nodenext module resolution

Open mjbvz opened this issue 1 year ago • 4 comments

This better enforces that imports end with a file extension and also use relative paths

mjbvz avatar Dec 19 '24 20:12 mjbvz

It seems required to set option module to NodeNext. But if we set "module": "NodeNext" the tsc will generate export {} at the end of the file in preload.js which results in error syntax since electron does not support esm in sandboxed preload script. CleanShot 2024-12-22 at 00 28 08@2x

BABA983 avatar Dec 21 '24 16:12 BABA983

It seems required to set option module to NodeNext. But if we set "module": "NodeNext" the tsc will generate export {} at the end of the file in preload.js which results in error syntax since electron does not support esm in sandboxed preload script.

Yes, thats a bug that I reported but was closed as "works as intended": https://github.com/microsoft/TypeScript/issues/60074

bpasero avatar Dec 21 '24 16:12 bpasero

It seems required to set option module to NodeNext. But if we set "module": "NodeNext" the tsc will generate export {} at the end of the file in preload.js which results in error syntax since electron does not support esm in sandboxed preload script.

Yes, thats a bug that I reported but was closed as "works as intended": microsoft/TypeScript#60074

Even if you don't use an import statement when the module is set to NodeNext in tsconfig.json it still generates export {} at the end of the file.

CleanShot 2024-12-22 at 13 44 06@2x

BABA983 avatar Dec 22 '24 05:12 BABA983

TS suggested add "moduleDetection": "legacy" which I think prevents export from being generated in non module files

This change also depend on merging #237989 to removed an old test file

mjbvz avatar Jan 15 '25 21:01 mjbvz

While you're in here, can you drop the use of paths? It's only a couple of mistakenly left over JSDoc comments that still use that, as far as I can tell.

jakebailey avatar Jan 22 '25 02:01 jakebailey

Would be great if this could move along 👍

bpasero avatar Jan 22 '25 11:01 bpasero

While you're in here, can you drop the use of paths? It's only a couple of mistakenly left over JSDoc comments that still use that, as far as I can tell.

Sent #238475.

jakebailey avatar Jan 22 '25 16:01 jakebailey