Employee Spotlight
From Academia to Industry
Philipp Burckhardt recounts his journey from childhood computer fascinations, to building an e-learning platform at Carnegie Mellon University, and on to his current role at Socket.
@babel/node
Advanced tools
Package description
@babel/node is a command-line tool that allows you to use Babel to compile and run JavaScript code on the fly. It is particularly useful for running scripts and applications written in ES6+ syntax without needing to precompile them.
Running ES6+ scripts
This feature allows you to run JavaScript files that use ES6+ syntax directly. The `babel-node` command compiles the code on the fly and executes it.
babel-node script.js
REPL with ES6+ support
You can start a REPL (Read-Eval-Print Loop) with ES6+ support by simply running `babel-node` without any arguments. This allows you to interactively write and test ES6+ code.
babel-node
Using Babel plugins and presets
You can specify Babel plugins and presets to customize the compilation process. For example, using the `@babel/preset-env` preset ensures that your code is transpiled to be compatible with the current environment.
babel-node --presets @babel/preset-env script.js
ts-node is a TypeScript execution environment and REPL for Node.js. It allows you to run TypeScript code directly without precompiling it. Compared to @babel/node, ts-node is specifically designed for TypeScript, whereas @babel/node is for JavaScript with ES6+ syntax.
esm is a fast, production-ready ES module loader for Node.js. It allows you to use ES modules in Node.js without needing to transpile them. While @babel/node focuses on compiling and running ES6+ syntax, esm focuses on providing native support for ES modules.
Sucrase is a super-fast alternative to Babel that focuses on compiling modern JavaScript syntax. It is designed to be faster than Babel by focusing on a smaller set of transformations. While @babel/node provides a comprehensive solution for compiling and running ES6+ code, Sucrase aims for speed and simplicity.
Changelog
v7.20.5 (2022-11-28)
babel-helpers
, babel-plugin-transform-destructuring
, babel-plugin-transform-modules-commonjs
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
, babel-traverse
babel-cli
, babel-helpers
, babel-plugin-proposal-class-properties
, babel-plugin-proposal-class-static-block
, babel-plugin-transform-classes
, babel-plugin-transform-runtime
, babel-preset-env
babel-helper-create-class-features-plugin
, babel-helpers
, babel-plugin-proposal-decorators
, babel-plugin-proposal-private-property-in-object
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-parser
babel-helper-wrap-function
, babel-preset-env
, babel-traverse
noNewArrow
assumption (@liuxingbaoyu)babel-plugin-transform-arrow-functions
, babel-plugin-transform-parameters
, babel-traverse
super()
in arrow functions with default / rest parameters (@SuperSodaSea)babel-helpers
, babel-node
, babel-plugin-proposal-async-generator-functions
, babel-plugin-transform-regenerator
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
regenerator
and add tests (@SuperSodaSea)babel-helper-create-regexp-features-plugin
regjsparser
for @babel/standalone
(@liuxingbaoyu)babel-parser
, babel-types
babel-generator
(``)
(@nicolo-ribaudo)babel-plugin-transform-block-scoping
, babel-traverse
switch
's discriminant
in the outer scope (@nicolo-ribaudo)babel-generator
comments:false
(@liuxingbaoyu)babel-plugin-transform-block-scoping
Readme
Babel command line
See our website @babel/node for more information.
Using npm:
npm install --save-dev @babel/node
or using yarn:
yarn add @babel/node --dev
FAQs
Babel command line
The npm package @babel/node receives a total of 630,933 weekly downloads. As such, @babel/node popularity was classified as popular.
We found that @babel/node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Employee Spotlight
Philipp Burckhardt recounts his journey from childhood computer fascinations, to building an e-learning platform at Carnegie Mellon University, and on to his current role at Socket.
Security News
Git dependencies in open source packages can introduce significant risks, including lack of version control, stability issues, dependency drift, and difficulty in auditing, making them potential targets for supply chain attacks.
Security News
Node.js has added experimental support for TypeScript, a move that highlights the growing importance of TypeScript in modern development.