npm install esbuild esbuild-sass-plugin --save-dev
npm install @wordpress/blocks @wordpress/element
package.json
{
"name": "twentyfive-child",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "node build.js",
"start": "node build.js --watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"esbuild": "^0.24.2",
"esbuild-sass-plugin": "^3.3.1"
},
"dependencies": {
"@wordpress/blocks": "^14.3.0",
"@wordpress/element": "^6.14.0"
}
}
build.js
const esbuild = require('esbuild');
(async () => {
const ctx = await esbuild.context({
entryPoints: ['src/index.js'],
bundle: true,
minify: true,
sourcemap: false,
outfile: 'dist/bundle.js',
target: ['es2015'],
loader: { '.js': 'jsx' },
});
await ctx.watch();
console.log('Watching for changes...');
})();