prateekbh / preact-material-components

preact wrapper for "Material Components for the web"
https://material.preactjs.com
MIT License
553 stars 81 forks source link

Update package.json with fesm2015 #1273

Open prateekbh opened 5 years ago

prateekbh commented 5 years ago

We should bundle both esm/es5 files in every package and expose them using fesm format

Spec details: "Angular Package Format" on Google Docs

cromefire commented 5 years ago

Looks good, but points to discuss:

prateekbh commented 5 years ago

Lets skip closure shall we? Its a huge hugeeee maintenance effort.

cromefire commented 5 years ago

tsickle is just a drop in typescript compiler, which handles that

prateekbh commented 5 years ago

Lets look at that but not make this a blocker for 2.0. Have had some bad experiences with closure compiler in past

cromefire commented 5 years ago

I would try it and if it doesn't work as a drop in, I would postpone it to after 2.0

cromefire commented 5 years ago

So can we agree on having only esm and es5? What browsers should we support for es5? I would say:

prateekbh commented 5 years ago

Actually I was going for es5 and fesm(flat esm) For es5: Babel-preset-env: last 2 browsers and IE11 For FESM: Babel-preset-env: esm

prateekbh commented 5 years ago

Or just use https://www.npmjs.com/package/babel-esm-plugin

cromefire commented 5 years ago

Actually I was going for es5 and fesm(flat esm)

Do you know a build system, that can handle fesm? I do not. And I don't know any advantage of fesm vs. esm

Babel-preset-env: esm

We should'n need babel at all

Or just use https://www.npmjs.com/package/babel-esm-plugin

But that's only for webpack

prateekbh commented 5 years ago

Esm uses native es modules but fesm does not.

Fesm are flattened modules, like from webpack. No native modules but the transportation is targeted to es2015.

This means we don't have to support native modules but we can ship stuff like async await, classes and more of es6

cromefire commented 5 years ago

This means we don't have to support native modules but we can ship stuff like async await, classes and more of es6

We should definitely include the files in es module format, without that there is no tree-shaking and with es modules included in all modern browser and node.js it will definitely the future, also because it's the only standardized module system.

cromefire commented 5 years ago

Esm uses native es modules but fesm does not.

@prateekbh Reading the docs, they do use es modules, but there is no good build system, but export {[...]} from "[...]"; does work