Last active
July 22, 2021 08:34
-
-
Save zgordon/e996a97384a09254f375bc0289b290c7 to your computer and use it in GitHub Desktop.
An example .babelrc file for working with Gutenberg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"presets": [ "@wordpress/default" ], | |
"plugins": [ | |
"transform-object-rest-spread", | |
[ | |
"transform-react-jsx", | |
{ | |
"pragma": "wp.element.createElement" | |
} | |
], | |
"transform-runtime", | |
], | |
} |
Is this the actual version now? Just simple:
{
"presets": ["@wordpress/babel-preset-default"]
}
and all the rest happens behind the scenes? Or do you need other Babel plugins too?
See more details at https://developer.wordpress.org/block-editor/reference-guides/packages/packages-babel-preset-default/ and https://github.com/WordPress/gutenberg/blob/HEAD/packages/babel-preset-default/index.js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used it and didnt work. Had to change
"transform-runtime"
for
"@babel/transform-runtime"
and, of course I had to install
npm i @wordpress/babel-preset-default -D
npm install --save-dev babel-plugin-transform-object-rest-spread
npm install --save-dev @babel/plugin-transform-runtime