A nodejs loader for babel. This allows you to compile all files with babel before they are executed in Node.
This project is similar to @babel/node, except that it works with ES modules.
npm install --save @node-loader/babel
# Or, if you prefer Yarn
yarn add --save @node-loader/babelIf using Node<16.12, use @node-loader/babel@1. Otherwise, use @node-loader/babel@latest
Run node with the --experimental-loader flag:
node --experimental-loader @node-loader/babel file.jsBabel configuration files are loaded and applied per the normal rules.
If you wish to combine the babel loader with other NodeJS loaders, you may do so by using node-loader-core.
Right now, node-loader-babel skips compilation of CommonJS modules since NodeJS' default implementation of load() returns no source code for commonjs modules. See #10 for more details.