From 4091bd3aff08801625c6128eec079af4a7b5dccb Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Sat, 27 Apr 2019 16:24:54 +0200 Subject: [PATCH] Docs: Add notes about esm support (closes #2278) --- README.md | 2 ++ docs/getting-started/2-javascript-and-gulpfiles.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 013c40770..aac4230e1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/getting-started/2-javascript-and-gulpfiles.md b/docs/getting-started/2-javascript-and-gulpfiles.md index 82573a13c..a15fad112 100644 --- a/docs/getting-started/2-javascript-and-gulpfiles.md +++ b/docs/getting-started/2-javascript-and-gulpfiles.md @@ -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 @@ -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