commonJsToGoogmoduleTransformer misses some `module.exports = ...` statements.
See original GitHub issuevisitTopLevelStatement
calls rewriteModuleExportsAssignment
, which transforms statements of the form module.exports = foo
to exports = foo
. However, it fails to do that same transformation if that statement is used to assign something else as well (e.g. var bar = module.exports = foo
should get transformed to var bar = exports = foo
, but does not)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Node Module Exports Explained - freeCodeCamp
exports being the exported component of any types - object, function, string, and so on. Default exporting in a Node.js module is as...
Read more >javascript - webpack: import + module.exports in the same ...
I got the error Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' . Turns out that changing import $...
Read more >Understanding module.exports and exports in Node.js
James shows how to work with modules in Node.js, focusing on how to export and consume them, and explaining ... So what has...
Read more >Add missing require() calls and module.exports statements
It uses ESLint programmatic API. codemode:addModuleExports. Find all javascripts inside app/components, filter by the lack of module.exports ...
Read more >Node.js Module Exports - Demystified - Stackify
Understand Node.js Module Exports and get comfortable using the syntax. ... You'll see it's done with some pretty ugly-looking if-statements ...
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
I think we don’t support commonjs in general, but only enough to massage TS’s commonjs output from ES module input. It’s not an intentional omission, we just have no TS code that uses commonjs directly.
Ah okay. I just noticed that the first line was transformed but the second one wasn’t, which I figured was a bug. I assumed this would be supported because the code very deliberately replaces
module.exports
withexports
, but not in all cases