-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript ESM issue #48835
Comments
This is happening because |
(That said, @The-Code-Monkey, you should unset |
@weswigham is this a bug? |
I mean, technically it's working as intended - |
So I'm facing a problem when I set |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
🔎 Search Terms
ESM build error
🕗 Version & Regression Information
Its in the nightly @next build do to with building an ESM package.
💻 Code
Hey guys, i need help i have a package im trying to convert to esm i have updated the package.json to type: module and the stuff in tsconfig.
https://github.com/The-Code-Monkey/TechStack/tree/feature/tcm-cli-to-esm/packages/tcm-cli
This is the package location, I am confused as it builds but when i try and use the dist index.js to lint the package it throws an error saying
Object.defineProperty(exports, "__esModule", { value: true });
^
ReferenceError: exports is not defined in ES module scope
This is because that line is being added by typescript to the index.js file within dist, there arent any other uses of the word exports in the dist folder so im not sure why typescript is adding it.
🙁 Actual behavior
It adds the
Object.defineProperty(exports, "__esModule", { value: true });
line into each of my files🙂 Expected behavior
This line shouldn't be added as im targeting ES2020 and nodenext with type: module.
which means it should compile down to esm but tsc is still compiling down to cjs for some reason.
The text was updated successfully, but these errors were encountered: