-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Output ES modules from typescript Webpack has some optimizations applied only when the input is using ES modules, not CommonJS. Outputting ES modules from typescript (and letting webpack deal with them) allows to apply these optimizations. * Refactor the mocking of the dependency loader Instead of replacing the exported object with a mock, which works only because of TS outputting CommonJS code and so webpack not seeing ES6 semantic for the export, the tests are now mocking the different methods of the object instead, preserving the object identity. This makes them compatible with the semantic of ES6 named exports. * Refactor the protocol to export an object with methods Exporting individual methods as named exports does not allow mocking these methods when using ES6 modules (as exports are referenced directly). As named exports were never imported directly, this has minimal impact on the consuming code. * Fix integration tests Webpack does not allow using module.exports in an ES module. Things were working fine before because TS modules were compiled to CommonJS before reaching webpack. Now that webpack sees them as ES modules (allowing more optimizations), the main entry point needs to be a CommonJS module explicitly (and so not using TS).
- Loading branch information
James Lees
authored
Sep 25, 2019
1 parent
6332937
commit b38d4eb
Showing
13 changed files
with
158 additions
and
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./pusher_integration_class').default; |
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
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.