Gutenberg Block Development: Trying to add custom js script to npm start command by modifying webpack.config
Need help understanding Provide your own webpack config https://developer.wordpress.org/block-editor/packages/packages-scripts/#provide-your-own-webpack-config
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
module.exports = {
...defaultConfig,
entry: {
...defaultConfig.entry,
//index: path.resolve( process.cwd(), 'src', 'index.js' ),
slider: path.resolve( process.cwd(), 'src', 'slider.js' ),
},
};
I am trying here to add a new scipt to the buid folder from src folder while developing a gutenberg block I get error:
ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `wp-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
Same for Adding other distinct css file how can I do it?
Topic block-editor scripts configuration Wordpress
Category Web