-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support circular dependencies and export let with experimentalImportS…
…upport Summary: Currently, `experimentalImportSupport` transforms named imports such that they're accessed immediately at the top level, eg: ```js import {foo} from 'bar'; export function getFoo() { return foo; } ``` Becomes ```js Object.defineProperty(exports, '__esModule', { value: true }); var foo = require('bar').foo; function getFoo() { return foo; } exports.getFoo = getFoo; ``` This immediate, top-level assignment of `require('bar').foo` to `foo` problematic for two reasons: 1. In the case of circular dependencies, the module at `'bar'` may not have been fully initialised, so that `foo` might be undefined at this point. 2. In the case where `bar` defines `export let foo = 'something mutable'`, a reassigment of `foo` within `'bar'` at runtime will not be reflected by the importing module. Differential Revision: D68394514
- Loading branch information
1 parent
ab33059
commit f38e4e3
Showing
8 changed files
with
316 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.