-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing from io-ts/es6 bundles (webpack) fp-ts/lib #349
Comments
@wmaurer what about replacing I mean // file /lib/index.d.ts
import { Either } from 'fp-ts/lib/Either'; // <= lib is ok here
import { Predicate, Refinement } from 'fp-ts/lib/function'; // file /es6/index.d.ts
import { Either } from 'fp-ts/es6/Either'; // <= replace lib with es6
import { Predicate, Refinement } from 'fp-ts/es6/function'; would it fix this issue? |
@gcanti thanks, I tested that out, and yes, it does fix the issue. My feeling, though, is that even then there's room for improvement here - is there a way to avoid having to specifying either EDIT: when I look at the rxjs |
I'm also creating a library that has a dependency to As @wmaurer mentioned, another solution (and a potentially better solution) would be to put every file into its own directory with all directories having its own
This solution would have to generate a directory + package.json during build, not very hard but not trivial either. |
@wmaurer released a patch as |
Correct me if I am wrong, but as I see it, with es6 tree shaking on the client-side via Webpack, is rollup for CommonJS necessary? |
@gcanti Have you seen recently released https://github.com/ReactiveX/rxjs/tree/master/src? It seems it's possible to have just one import path for everything. |
I believe this can be closed now that #507 was merged and deployed? My bundle doesn't seem to include it. |
That said, perhaps not related to this particular issue but I am interested in if there's potential for reducing the bundle size of this library - I use it only for |
@wmaurer @anilanar @steida from
@osdiab mmmh weird, the stable APIs should only use the |
Ah it's probably because I use |
🐛 Bug report
Current Behavior
If I import from
io-ts/es6
,fp-ts/lib
ends up in the bundle (via webpack):Expected behavior
Ideally I'd like
fp-ts/es6
in the bundle. It would look like this:(this result can be achieved with a work-around, see additional context section).
Reproducible example
If needed I can post a repo.
Additional context
There is a work-around, suggested by @jollytoad (to solve another issue):
gcanti/fp-ts#860 (comment)
I have also commented on the same issue, confirming that the work-around fixes the bundling problem:
gcanti/fp-ts#860 (comment)
Your environment
This problem effects
io-ts
versions 1 and 2.The text was updated successfully, but these errors were encountered: