@@ -18,6 +18,7 @@ Status](https://travis-ci.org/dphilipson/transducist.svg?branch=master)](https:/
1818 - [ Using custom reductions] ( #using-custom-reductions )
1919 - [ Creating a standalone transducer] ( #creating-a-standalone-transducer )
2020- [ Bundle Size and Tree Shaking] ( #bundle-size-and-tree-shaking )
21+ - [ ES Modules and Node] ( #es-modules-and-node )
2122- [ Benchmarks] ( #benchmarks )
2223- [ API] ( #api )
2324
@@ -106,6 +107,9 @@ With NPM:
106107npm install --save transducist
107108```
108109
110+ If running in a Node environemnt, make sure to check the note [ ES Modules and
111+ Node] ( #es-modules-and-node ) below.
112+
109113This library, with the exception of the functions which relate to ` Set ` and
110114` Map ` , works fine on ES5 without any polyfills or transpilation, but its
111115TypeScript definitions depend on ES6 definitions for the ` Iterable ` type. If you
@@ -272,6 +276,19 @@ For details, [see the tree shaking
272276API] ( https://github.com/dphilipson/transducist/blob/master/docs/api.md#tree-shakeable-api )
273277section of the API docs.
274278
279+ ## ES Modules and Node
280+
281+ Transducist is distributed with ES module syntax (i.e. ` import ` /` export ` , not
282+ ` require() ` ) because doing so is required to take advantage of tree shaking. If
283+ you're running in a Node environment or your bundler is so old that it doesn't
284+ understand this syntax, you may encounter runtime errors complaining about
285+ unexpected tokens in ` import ` statements. To resolve this, use a CommonJS
286+ version of this library by importing from ` transducist/cjs ` instead:
287+
288+ ``` ts
289+ const { chainFrom } = require (" transducist/cjs" );
290+ ```
291+
275292## Benchmarks
276293
277294[ View the
0 commit comments