[go: up one dir, main page]

Skip to content

Commit

Permalink
Docs: Add notes about esm support (closes #2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Apr 27, 2019
1 parent 3c66d95 commit 4091bd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ exports.default = build;

## Use latest JavaScript version in your gulpfile

__Most new versions of node support most features that Babel provides, except the `import`/`export` syntax. When only that syntax is desired, rename to `gulpfile.esm.js`, install the [esm][esm-module] module, and skip the Babel portion below.__

Node already supports a lot of __ES2015+__ features, but to avoid compatibility problems we suggest to install Babel and rename your `gulpfile.js` to `gulpfile.babel.js`.

```sh
Expand Down
3 changes: 3 additions & 0 deletions docs/getting-started/2-javascript-and-gulpfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ You can write a gulpfile using a language that requires transpilation, like Type
* For TypeScript, rename to `gulpfile.ts` and install the [ts-node][ts-node-module] module.
* For Babel, rename to `gulpfile.babel.js` and install the [@babel/register][babel-register-module] module.

__Most new versions of node support most features that TypeScript or Babel provide, except the `import`/`export` syntax. When only that syntax is desired, rename to `gulpfile.esm.js` and install the [esm][esm-module] module.__

For a more advanced dive into this topic and the full list of supported extensions, see our [gulpfile transpilation][gulpfile-transpilation-advanced] documentation.

## Splitting a gulpfile
Expand All @@ -33,3 +35,4 @@ Node's module resolution allows you to replace your `gulpfile.js` file with a di
[gulpfile-transpilation-advanced]: ../documentation-missing.md
[ts-node-module]: https://www.npmjs.com/package/ts-node
[babel-register-module]: https://www.npmjs.com/package/@babel/register
[esm-module]: https://www.npmjs.com/package/esm

0 comments on commit 4091bd3

Please sign in to comment.