Open leon opened 8 years ago
esm is ES6 module package.
The es5 version is packages into 1 UMD file in the bundle
directory.
The package.json main
property points to the bundle version (es5)
But if you use a bundler it will look the at module
property which points to the ESM version.
This is no different then how angular is built...
We have to differentiate between the module system and what the target runtime is.
We need to output typescript to the es6 module system so that webpack2 or rollup can do it's tree shaking thing, but compile all the code into es5 so that it runs in all browsers.
I've checked in the angular code base and cannot find a single =>
function in their compiled esm code.
Therefor I think we should change into:
"compilerOptions": {
"module": "es6",
"target": "es5"
}
What do you think @shlomiassaf, am I wrong?
I have the same problem when importing from webpack. I can't make a production version because of const (problem with iOS, because of the strict mode) and =>
arrow functions.
@leon I updated that line, and now things are compiling fine. I'll submit a PR.
Published 2.0.1, please close if fixed :)
This is fixed. Please close it 👍
When I try to build my angular-cli beta.16 app I get
I've traced it to your utils.js file in /esm/framework/utils.js
https://github.com/shlomiassaf/angular2-modal/blob/master/src/components/angular2-modal/framework/utils.ts#L32
https://github.com/shlomiassaf/angular2-modal/blob/master/src/components/angular2-modal/framework/utils.ts#L65
That file contains es6 functions which cause UglifyJs sprit out an error.
Could it be that the 2.0.0 package is broken, or that you aren't compiling utils.ts to es5?