Skip to content

Commit

Permalink
Create .mjs entry points for module bundlers supporting ESM.
Browse files Browse the repository at this point in the history
In modern bundlers (ex: [Webpack][1] and [Rollup][2]), .mjs have a
higher priority than .js.  This change will make those load ES modules
instead of the commonjs versions, so the code can be [treeshaked][3] and
[hoisted][4].

This will bypass the Babel build, but in general bundlers will use a
compiler to support the ES* features needed.

[1]: https://webpack.js.org/configuration/resolve/#resolve-extensions
[2]: https://github.com/rollup/rollup-plugin-node-resolve#usage
[3]: https://webpack.js.org/guides/tree-shaking/
[4]: https://webpack.js.org/plugins/module-concatenation-plugin/
  • Loading branch information
BenoitZugmeyer committed Jan 19, 2019
1 parent 2884a01 commit 5431d84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions extras.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/extras.js';
1 change: 1 addition & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Observable as default } from './src/Observable.js';

0 comments on commit 5431d84

Please sign in to comment.