Possible to have `export default` emit as `module.exports`
See original GitHub issueI know it’s not the preferred way of having a default export, but it would save a lot of time if this would be possible. I’m writing an ESLint plugin and currently cannot import the plugin into a CJS file because the module is exported as module.exports.default
rather than simply module.exports
.
Have only come across this issue which I wasn’t able to find a way to implement it properly: https://github.com/egoist/tsup/issues/283 and also #255 but I got the warnings below:
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
export - JavaScript - MDN Web Docs
Every module can have two different types of export, named export and default export. You can have multiple named exports per module but ......
Read more >Difference between destructing export default and module ...
If you export defualt you need to import it like import env from 'location' (Look I emit the {} part) and then access...
Read more >Understanding Modules and Import and Export Statements in ...
Default Exports Modules can also contain a default export, using the default keyword. A default export will not be imported with curly brackets...
Read more >Use Named Exports over Default Exports in JavaScript
Default Exports vs Named Exports. The export statement is used when creating JavaScript modules and you want to share objects, functions, ...
Read more >TSConfig Option: allowSyntheticDefaultImports - TypeScript
This option brings the behavior of TypeScript in-line with Babel, where extra code is emitted to make using a default export of a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW, I solved this by adding this to my tsup config –
See https://github.com/getoslash/eslint-plugin-tap/pull/36 for reference.
I am wondering why
it's not the preferred way of having a default export
. Could you explain any arguments for me, thanks~~