fix(ngcc): handle CommonJS re-exports by reference (#34254)

In TS we can re-export imports using statements of the form:

```
export * from 'some-import';
```

This can be downleveled in CommonJS to either:

```
__export(require('some-import'));
```

or

```
var someImport = require('some-import');
__export(someImport);
```

Previously we only supported the first downleveled version.
This commit adds support for the second version.

PR Close #34254
This commit is contained in:
Pete Bacon Darwin
2019-12-18 14:03:04 +00:00
committed by Kara Erickson
parent b2a8466e45
commit 9ca5faab47
2 changed files with 37 additions and 23 deletions

View File

@ -557,7 +557,8 @@ exports.xtra2 = xtra2;
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./b_module"));
var b_module = require("./b_module");
__export(b_module);
__export(require("./xtra_module"));
`
},