Exported hoisted functions not moved to the top of Common JS module
See original GitHub issueCurrently, there’s an issue when consuming Common JS modules from node_modules
where hoisted function declarations are converted to var
assignments and not moved to the top of the file. There’s a particular example in React ( see https://github.com/facebook/react/issues/8894 for more context, and a specific code example) which demonstrates this issue.
I also found this in other modules, such as json-stringify-safe
(https://github.com/isaacs/json-stringify-safe/blob/5930d6e51c58cf3a134f36301b029408bcfd09e5/stringify.js#L1-L6).
This seems to be a bug in Closure Compiler, and seems to only happen when that particular function is exported from the module.
Please excuse me if this has already been mentioned somewhere. From a quick search through the issues I couldn’t find anything related.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
No problem at all - I rarely get such exact bug reports. I’m actually working on a fix right now.
Closed by 5e0a570