Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

#113: Targeting ES5 environments with module file while maintaining import/export statements for tree shaking #114

Closed
wants to merge 2 commits into from

Conversation

kayneb
Copy link

@kayneb kayneb commented Mar 5, 2018

This PR updates the Typescript config so that the outputted JS is ES5 compatible, yet maintains import/export statements, as per is intended by the module attribute (https://github.com/rollup/rollup/wiki/pkg.module).

@kayneb
Copy link
Author

kayneb commented Mar 5, 2018

Just noticed the tests aren't working anymore. Will look into it when I get the chance.

@alexandru
Copy link
Member

alexandru commented Mar 6, 2018

@kayneb thanks for the PR, but I don't agree with the premise.

The "module" declaration in package.json points towards ECMAScript 6 binaries. Eventually all JavaScript engines will support the entirety of the ECMAScript 6 specification in full. And it's actually tools like Webpack or Rollup that are behind and it's a bad idea to compromise the integrity of the package for tools that may not be relevant in a couple of months from now, given the ecosystem's rapid pace of migration to new tools when they happen 😉

If you want ES5 code with ES2015 modules, Funfix packages already come with such a compiled binary. So instead of ...

import * as ff from "funfix"

import { Try } from "funfix-core"

All you need to do is to give it a path to /dist/es5:

import * as ff from "funfix/dist/es5"

import { Try } from "funfix-core/dist/es5"

This will keep tools like Webpack happy.

@kayneb
Copy link
Author

kayneb commented Mar 6, 2018

Ah I didn't realize that file had ES6 exports still. Yeah that makes sense. Thanks.

@kayneb kayneb closed this Mar 6, 2018
@codecov
Copy link

codecov bot commented Mar 6, 2018

Codecov Report

Merging #114 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #114    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          17     17            
  Lines        2197   2350   +153     
  Branches      422    442    +20     
======================================
+ Hits         2197   2350   +153
Impacted Files Coverage Δ
packages/funfix-exec/src/future.ts 100% <0%> (ø) ⬆️
packages/funfix-exec/src/time.ts 100% <0%> (ø) ⬆️
packages/funfix-core/src/disjunctions.ts 100% <0%> (ø) ⬆️
packages/funfix-exec/src/ref.ts 100% <0%> (ø) ⬆️
packages/funfix-exec/src/scheduler.ts 100% <0%> (ø) ⬆️
packages/funfix-core/src/errors.ts 100% <0%> (ø) ⬆️
packages/funfix-effect/src/eval.ts 100% <0%> (ø) ⬆️
packages/funfix-effect/src/io.ts 100% <0%> (ø) ⬆️
packages/funfix-exec/src/cancelable.ts 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09bb885...eb47e39. Read the comment docs.

@alexandru
Copy link
Member

Cool. So the /dist/es5 bundle is there precisely to deal with Webpack et all. If you have problems with that, open another issue to discuss it.

Also happily accepting other PRs 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants