Transpiling via gulp-babel
for the server and browserify
with babelify
for the client - using async and await in my code. These features seem to transform just fine, but...
Error: Cannot find module 'babel-runtime/helpers/typeof'
Contents of .babelrc
{
"presets": ["react", "es2015"],
"plugins": [
"transform-class-properties",
"transform-async-to-generator",
"transform-runtime"
]
}
Relevant contents of package.json
"babel-core": "6.3.13",
"babel-eslint": "4.1.6",
"babel-plugin-transform-async-to-generator": "6.3.13",
"babel-plugin-transform-class-properties": "6.3.13",
"babel-plugin-transform-runtime": "6.3.13",
"babel-preset-es2015": "6.3.13",
"babel-preset-react": "6.3.13",
"babelify": "7.2.0",
"browserify": "12.0.1",
"gulp-babel": "6.1.0",
I have found a few other mentions of this, many of which seem to lead here - https://github.com/babel/babel/issues/2954
But I am getting a 404 at the link above and indeed cannot see any issues related to babel
- https://github.com/babel/babel/issues redirects to https://github.com/babel/babel/pulls
Any ideas?
Calling any other modules available under /node_modules works fine. Need to be able to call @babel/runtime/... Note: "@babel/runtime": "^7.9.0" in dependencies added for testing if this can resolve the issue.
This duplication is sometimes unnecessary, especially when your application is spread out over multiple files. This is where the @babel/plugin-transform-runtime plugin comes in: all of the helpers will reference the module @babel/runtime to avoid duplication across your compiled output.
@babel/runtime is just the package that contains the implementations of the functions in a modular way.
This is meant to be used as a runtime dependency along with the Babel plugin @babel/plugin-transform-runtime. Please check out the documentation in that package for usage. Sometimes Babel may inject some code in the output that is the same across files, and thus can be potentially re-used. For example, with the class transform (without loose mode):
Turns out I needed to take the install of babel-runtime
, which I thought had been deprecated with the release of Babel v6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With