// Set from https://www.npmjs.com/package/@wordpress/scripts // Add package.json with the @wordpress/scripts dependency. // Add a root file called webpack.config.js // Import the original config from the @wordpress/scripts package. const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); // Import the helper to find and generate the entry points in the src directory const { getWebpackEntryPoints } = require( '@wordpress/scripts/utils/config' ); // Add any a new entry point by extending the webpack config. module.exports = { ...defaultConfig, entry: { ...getWebpackEntryPoints(), variations: './variations/index.js', // to variations file in theme. 'stream-meta-panel': './stream-meta-panel/index.js', // Custom directory having JS to compile }, };