Skip to content

Commit 24bfdda

Browse files
skevyfacebook-github-bot-7
authored andcommitted
Adds support for ES6 export syntax to the packager's DependencyResolver.
Summary: This PR includes: - A regex that allows for the `export` syntax. - Updated tests. Closes facebook#3465 Reviewed By: svcscm Differential Revision: D2550322 Pulled By: vjeux fb-gh-sync-id: 7d35f436af13cf5b6b1287835a18a9693ec1be8a
1 parent da25067 commit 24bfdda

File tree

4 files changed

+385
-2
lines changed

4 files changed

+385
-2
lines changed

packager/react-packager/src/DependencyResolver/Module.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,14 @@ function extractRequires(code /*: string*/) /*: Array<string>*/ {
159159
deps.sync.push(dep);
160160
return match;
161161
})
162+
.replace(replacePatterns.EXPORT_RE, (match, pre, quot, dep, post) => {
163+
deps.sync.push(dep);
164+
return match;
165+
})
162166
// Parse the sync dependencies this module has. When the module is
163167
// required, all it's sync dependencies will be loaded into memory.
164168
// Sync dependencies can be defined either using `require` or the ES6
165-
// `import` syntax:
169+
// `import` or `export` syntaxes:
166170
// var dep1 = require('dep1');
167171
.replace(replacePatterns.REQUIRE_RE, (match, pre, quot, dep, post) => {
168172
deps.sync.push(dep);

0 commit comments

Comments
 (0)