Skip to content

Instantly share code, notes, and snippets.

@mt8
Last active September 5, 2019 03:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mt8/feb4ca6b4e57ba6747c7418af10e4b10 to your computer and use it in GitHub Desktop.
Save mt8/feb4ca6b4e57ba6747c7418af10e4b10 to your computer and use it in GitHub Desktop.
Block Editor Handbook やるときのwebpack設定など
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
{
"name": "gutenberg_examples",
"version": "1.0.0",
"description": "",
"main": "block.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7"
},
"dependencies": {}
}
module.exports = {
mode: "development",
context: __dirname,
entry: './block.esnext.js',
output: {
path: __dirname,
filename: "block.js"
},
module: {
rules: [{
exclude: /node_modules/,
loader: 'babel-loader',
}],
},
}
@mt8
Copy link
Author

mt8 commented Sep 1, 2019

こんな階層で作業する感じです。

  • plugin.php #register_block_typeなど
  • block.esnext.js #ハンドブックの「ES Next」のソースを持ってくる
  • block.js #トランスパイル後のjsソース(編集しない)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment