Registry / devops / babel-watch

babel-watch

JSON →
library7.8.1jsnpmunverified

A fast file watcher and restarter for babel-node apps. Instead of restarting babel-node on each change (which is slow), it runs babel transpilation once in a master process and spawns a plain node child with the transpiled code. Current stable version is 7.8.1, with a maintenance release cadence. Key differentiators: autowatch (automatically watches files as they are required), faster restarts than nodemon+babel-node, and supports Babel 7.

npm install babel-watch
INSTALL
IMPORT
SIG · BABEL-WATCH
B
babel-watch
devopsjavascriptv7.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Installs babel-watch as a dev dependency and creates an npm script to run it with a source file.

{ "scripts": { "start": "babel-watch src/main.js" } } # Then run: npm start
babel-watch --version
Debug
Known issues
breakingbabel-watch v7 requires Node >= 8 and @babel/core ^7.0.0. It will not work with older Node versions or Babel 6.
fix
Update Node to >=8 and install @babel/core@^7.
affects: >=7.0.0
gotchaWhen using --ignore, node_modules are ignored by default. If you specify a custom --ignore, you must include node_modules explicitly if you still want to ignore it.
fix
Use --ignore 'node_modules' along with other patterns, e.g., --ignore 'node_modules,dist'.
affects: >=7.0.0
gotchaThe --inspect option's address must be specified as a separate argument when using = syntax may cause issues.
fix
Use --inspect 0.0.0.0:9229 instead of --inspect=0.0.0.0:9229.
affects: >=7.0.0
deprecatedThe -d and -B debug options are deprecated; use --inspect or --inspect-brk instead.
fix
Replace -d with --inspect and -B with --inspect-brk.
affects: >=7.0.0
gotchaAutowatch may ignore files in node_modules by default but may still watch them if they are required. Use -x to exclude additional directories.
fix
Pass -x node_modules to exclude node_modules from autowatch.
affects: >=7.0.0
Errors
Common errors & fixes
babel-watch: error: unknown option `--config-file'
Using --config-file with babel-watch versions older than 7.5.0 which do not support that option.
fix
Update babel-watch to v7.5.0 or later: npm install babel-watch@latest
Error: Cannot find module '@babel/core'
@babel/core is a peer dependency of babel-watch and must be installed separately.
fix
Install @babel/core: npm install --save-dev @babel/core
babel-watch: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
The process ran out of memory due to large files or circular requires causing infinite loops.
fix
Increase Node memory limit with --max_old_space_size, or exclude unnecessary directories with --ignore.
(node:12345) [DEP0005] DeprecationWarning: ...
Using deprecated debug options (-d or -B).
fix
Use --inspect or --inspect-brk instead.
Error: listen EADDRINUSE :::9229
Another process is already using the inspector port when using --inspect without a custom port.
fix
Specify a different port with --inspect 0.0.0.0:9230
Upgrade
Version history
7.8.1latest on npm
Audit
Dependencies
@babel/coreoptionalPeer dependency; babel-watch requires @babel/core to be installed separately in the project to perform transpilation.
Agent activity
4 hits · last 30 days
node
4
Resources
babel-watch — npm install babel-watch · libregistry