Skip to content

Commit 2613be9

Browse files
committed
Step 5: Setup Babel using WordPress's default preset
1 parent bbd655d commit 2613be9

File tree

5 files changed

+49
-2
lines changed

5 files changed

+49
-2
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@wordpress/default"]
3+
}

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"author": "Riad Benguella",
1717
"license": "MIT",
1818
"devDependencies": {
19+
"@babel/core": "^7.1.0",
20+
"@wordpress/babel-preset-default": "^2.1.0",
1921
"parcel-bundler": "^1.10.1"
2022
}
2123
}

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
console.log("Start the engine!");
1+
const { createElement } = wp.element;
2+
3+
console.log(<div>Start the JSX engine</div>);

wp-js-plugin-starter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function wp_js_plugin_starter_register_script() {
3131
wp_register_script(
3232
'wp-js-plugin-starter',
3333
wp_js_plugin_starter_url( 'dist/index.js' ),
34-
array()
34+
array( 'wp-element' )
3535
);
3636
}
3737

0 commit comments

Comments
 (0)