[babel-preset-razzle] TypeError: [BABEL] commonjsPlugin.apply is not a function
See original GitHub issueš Bug report
After integrating razzle to an existing project, when I go to run razzle start
, I get the following error:
~/node_modules/babel-preset-razzle/babel-plugins/commonjs.js:4
const commonjs = commonjsPlugin.apply(null, arguments);
^
Error: Module build failed (from ./node_modules/razzle/config/babel-loader/razzle-babel-loader.js):
TypeError: [BABEL] ~/server/app.js: commonjsPlugin.apply is not a function (While processing: "programmatic item")
which works after I change this line to the following:
const commonjs = commonjsPlugin.default.apply(null, arguments);
I canāt share any of the existing code, but I can share any relevant dependencies that could be related to this, such as babel plugins, etcā¦ FWIW, Iām also using the newBabel
experimental flag, because the root of the project uses a babel.config.js
, which seems to get ignored otherwise.
Current Behavior
Expected behavior
It shouldnāt error
Reproducible example
Suggested solution(s)
Iām not exactly sure. This bug doesnāt happen when using one of the example templates, so there might be an edge case with my project Iām missing.
Additional context
Your environment
Software | Version(s) |
---|---|
Razzle | ^3.3.11, ^3.3.12 |
Razzle Plugins | none. |
Node | v14.13.0 |
Browser | |
npm/Yarn | yarn v1.22.10 |
Operating System | macOS 10.15.7 |
TypeScript | |
React | ^16.10.2 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:17
Top Results From Across the Web
TypeError: babel is not a function when using Node 14 Ā· Issue ...
SyntaxError: The requested module '@rollup/plugin-babel/dist/index.es.js' is expected to be of type CommonJS, which does not support namedĀ ...
Read more >TypeError: (0 , _index.default) is not a function when using ...
I have rollup working without @rollup/plugin-babel enabled. As soon as I import @rollup/plugin-babel (and thereby Babel) in the application ...
Read more >babel/plugin-transform-modules-commonjs
This plugin transforms ECMAScript modules to CommonJS. Note that only the syntax of import/export statements ( import "./mod.js" ) and import expressionsĀ ...
Read more >@rollup/plugin-babel - npm
Seamless integration between Rollup and Babel. ... Start using @rollup/plugin-babel in your project by running `npm i @rollup/plugin-babel`.
Read more >How to use the babel-jest.createTransformer function in ... - Snyk
plugins.push('@babel/plugin-transform-modules-commonjs'); module.exports = babelJest.createTransformer(babelConfig);.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in v3.3.13
I see what it is, will fix tomorrow.