I have an angular-cli application and i use Angular IMask Plugin. Angular IMask Plugin wraps vanila imaskjs which has "package.module" in es2015 format alongside with "package.main" in es5 umd format. While building angular-cli takes "package.module" but does not transpile it with babel and therefore my app does not work in IE.
How can i configure angular-cli to include imaskjs to be transpiled? It could be solved in webpack like this But what about angular-cli? Is eject is the only solution?
Is it ok to distribute "package.module" in es2015 format for libraries or it should be in es5 as well?
Angular CLI: 1.6.4
Node: 7.10.0
OS: win32 x64
pkg.module is esm format as described here:
pkg.module will point to a module that has ES2015 module syntax but otherwise only syntax features that the target environments support.
Probably the library has to be transpiled to ES5 but keeping ES2015 modules. But I think it is better to give the user a choice to target prefered environment leaving unused polyfills away. So may be it is a good idea to have and option to configure angular-cli transpiling some modules.
Libraries that are meant to support older browser versions should ship both ES2015 and ES5 code. And it will be up to the build system to determine which on to use.
See https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview#heading=h.k0mh3o8u5hx for more details.
@alan-agius4 I agree that libraries should ship transpiled code so they are usable in older browsers, but I've run into quite a few that do not. (And at least one prominent maintainer has a policy of not providing transpiled code.)
It's painful to have to maintain and package a fork or copy-paste source code into the consuming project. It would be nice if Angular CLI could assist somehow, even if some manual configuration per library is required.
I think its an unreasonable expectation that library maintainers provide multiple builds to cater to all environments. As @alan-agius4 pointed out, some maintainers have taken a stance against this needless complexity by distributing only a single library build. The purpose of our tooling (i.e. the bundler) is to isolate us complexity and increase productivity. Supporting transpilation of dependencies would really be helpful.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
pkg.moduleisesmformat as described here:Probably the library has to be transpiled to ES5 but keeping ES2015 modules. But I think it is better to give the user a choice to target prefered environment leaving unused polyfills away. So may be it is a good idea to have and option to configure angular-cli transpiling some modules.