mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-03 23:35:06 +08:00
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 https://github.com/facebook/react-native/pull/3465 Reviewed By: svcscm Differential Revision: D2550322 Pulled By: vjeux fb-gh-sync-id: 7d35f436af13cf5b6b1287835a18a9693ec1be8a
This commit is contained in:
committed by
facebook-github-bot-7
parent
da250671e5
commit
24bfdda499
@@ -159,10 +159,14 @@ function extractRequires(code /*: string*/) /*: Array<string>*/ {
|
||||
deps.sync.push(dep);
|
||||
return match;
|
||||
})
|
||||
.replace(replacePatterns.EXPORT_RE, (match, pre, quot, dep, post) => {
|
||||
deps.sync.push(dep);
|
||||
return match;
|
||||
})
|
||||
// Parse the sync dependencies this module has. When the module is
|
||||
// required, all it's sync dependencies will be loaded into memory.
|
||||
// Sync dependencies can be defined either using `require` or the ES6
|
||||
// `import` syntax:
|
||||
// `import` or `export` syntaxes:
|
||||
// var dep1 = require('dep1');
|
||||
.replace(replacePatterns.REQUIRE_RE, (match, pre, quot, dep, post) => {
|
||||
deps.sync.push(dep);
|
||||
|
||||
Reference in New Issue
Block a user