tomwanzek / d3-ng2-service

A D3 service for use with Angular.
MIT License
205 stars 42 forks source link

fix(bundle): work with ES2015-aware bundlers #40

Closed awerlang closed 7 years ago

awerlang commented 7 years ago

I think jsnext:main is incorrectly pointing to an ES2015+ dist. To avoid any breakages, I'm including a module field to be used with ES2015 bundlers. It points to a dist file in ES5 with ES2015 module syntax.

Reference: https://github.com/rollup/rollup/wiki/pkg.module

tomwanzek commented 7 years ago

@awerlang Thx for the PR. When I originally wrote the service, I matched the compilation settings and entry points to those of angular-cli at the then current beta (and the corresponding angular approach)

As of the current angular module package.json, it seems to be time to change the approach to using module to refer to the target: es5 / module: es:2015 build as you suggest, and adding another field "es2015": "esm/index.js" for thetarget: es2015 / module: es:2015` entry point.

I guess, dropping the jsnext:main would then be fine given the interchangeability. Thoughts?

With the recent releases of Angular, it seems time to review the compilation settings and dev dependencies more broadly...

awerlang commented 7 years ago

I guess, dropping the jsnext:main would then be fine given the interchangeability. Thoughts?

I guess rollup, webpack and systemjs users won't be affected, so +1.

tomwanzek commented 7 years ago

@awerlang Thx for the pointer above 👍 . I have decided to do some housekeeping and incorporated your suggested change in the PR #44. Have a look and let me know, if anything else jumps out. Cheers, T.

I am going to close this PR in turn. 😄