Reputation: 724
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?
Upvotes: 7
Views: 6525
Reputation: 9859
You can also use an environment variable to bypass babel-node
having to support the flag all together.
NODE_OPTIONS=--max-old-space-size=16384 babel-node [options] [ -e script | script.js ] [arguments]
In my case I needed to use --tls-min-v1.0
but babel-node doesnt know that flag.
NODE_OPTIONS=--tls-min-v1.0
did the trick.
Upvotes: 1
Reputation: 9859
I am using Babel 7, and this does in fact work.
babel-node --max-old-space-size=16384 script.js
Easy way to test is to just lower the size to 100KB, and you will run out of memory quickly.
Upvotes: 7
Reputation: 869
There is a bug maybe related to node v10... v8flags v2 is not working well, you need to use current v8flags 3.1.1.
I'm using yarn for global node tools, here are the quick command to do a quick patch (likely to be redone on each yarl global add
)...
If using babel-cli 6 yarn global add v8flags rm -rf ~/.config/yarn/global/node_modules/babel-cli/node_modules/v8flags
You could use babel 7, but there is a lot of change to do in your babel configs yarn global add @babel/core @babel/node
Upvotes: 1
Reputation: 1709
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.
Upvotes: 6