node.jsbabeljsbabel-cli

How to pass options to node when using babel-node


Babel CLI docs (https://babeljs.io/docs/usage/cli/):

babel-node [options] [ -e script | script.js ] [arguments]

But when trying to increase allocated memory for Node:

babel-node --max-old-space-size=16384 script.js

argument --max-old-space-size=16384 seems to be ignored

Does sb know if this should work, and if shouldn't - some workaround?


Solution

  • Edit: (Juli 2016) As of version 6.11.4 all variations are supported now. The example posted in the question works now.


    Babel in version 6.11.3 does not support all variations of v8Flags yet.

    Node itself supports passing this flags either with underscore (--max_old_space_size) or dashes (--max-old-space-size).

    In contrast babel-node only supports these flags if the are specified with underscores and does not support the format --flag=value.

    There is a open pull request, that addresses this issues. Sadly there is no current workaround for specifying v8Flags with values.