I want to use babel runtime in a big/complex nodejs app. I don't want to use the babel require hook because the app is big and when I have tried to use it I get the following error:
RangeError: Maximum call stack size exceeded
And I only want to transpile a few JS files, at least for now.
The babel docs are a bit cryptic for the runtime support. After installing babel-runtime, they provide:
require("babel").transform("code", { optional: ["runtime"] });
Where does that code get included? And is "code" truly just a string? I have tried to add that to my main app.js file (express 3 app). Unfortunately, that doesn't work.
runtime
to the list of transformations you run on your code. If you are compiling via the CLI, you'd do--optional runtime
, if you're using something else, you'd need to pass the options to that. The.transform
example is if you were programmatically using the Babel API to compile your file, you wouldn't call it from your own code, just build scripts. How are you building now? – loganfsmyth