question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A build that uses ES6 modules

See original GitHub issue

With several module bundlers (webpack 2 and rollup) now supporting tree shaking:

Tree shaking? Normally if you require a module, you import the whole thing. ES2015 lets you just import the bits you need, without mucking around with custom builds. It’s a revolution in how we use libraries in JavaScript, and it’s happening right now.

It would be amazing if there was a turf build using import. This would drastically reduce the build size (which is now nearing ~500kb with just a handful of features being used).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
tmcwcommented, Jun 13, 2016

I’m not really convinced on the value of issues anymore: difficult open issues on repositories have a negligible chance of being picked up by passers-by and getting fixed. Is a two-year old issue more useful than no issue at all? Issues that are difficult end up just getting +1ed or “is this fixed” for the duration of time before they either get locked, a maintainer implements them, or they become required in some other way, like if the functionality becomes essential to someone’s project or company, and in that case they’re going to implement the feature issue or not.

I think issues work well for small changes or bug reports, but for large features they’re often counterproductive or a productivity placebo.

3reactions
tmcwcommented, Jun 13, 2016

Sorry - I’m trying to slim down Turf’s issues to those that are actionable immediately. Right now we have quite a few issues that are very long-term and almost no core maintainer time (i led the vast majority of turf 3 solo), so focusing is a priority. Closing issues does not mean that it’s deprioritizing the request or saying that nobody should do it: I want PRs to be the primary documentation of work rather than issues, and I explicitly will say that a PR is accepted if I close an issue.

Problems here are:

  • ES6 module support in Node.js is still very far away and no other JavaScript runtime - no browser - supports ES6 modules. This means that tests for es6-turf will require a transpilation step, always, which is a total bummer and a big change in our infrastructure’s simplicity
  • Top-level es6 modules with lower-down commonjs doesn’t really work; this is what I tried to do with simple-statistics and it turned out that if you really want tree-shaking you need more than a top-level file.

Lodash is able to support ES6 modules mainly because it’s a very… meta project. All of the lodash code is generated dynamically for every single build, and it’s totally different than any other JavaScript project in the whole ecosystem. Going the lodash way would be awesome, but would be a massive change.

Sorry again that closing the issue seemed counterproductive: this is not a “no for everyone”, it’s me trying to define the scope given my estimation of the work’s time requirement versus its benefit and other features, and keeping Turf’s scope to a level that’s accomplishable without further severe burnout.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Practical guide to ES6 modules - freeCodeCamp
In this article, we'll create a simple dashboard using ES6 modules, and then present optimization techniques for improving the folder ...
Read more >
Using Native, Unbundled ES6 Modules With a Simple Build ...
ES6 modules or ESM) natively in every environment, from development to production. No bundling, code chunking / splitting, or other complicated ...
Read more >
How to build, test and release a node module in ES6
How to build, test and release a node module in ES6 · Prerequisites · Create an account on npm · Login to npm...
Read more >
A minimalist development workflow using ES6 modules and ...
You can think of Snowpack as a Webpack alternative that uses ES6 modules to simplify and speed up your development workflow. When we...
Read more >
JavaScript modules - MDN Web Docs
Importing modules using import maps. Above we saw how a browser can import a module using a module specifier that is either an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found