const path = require( 'path' ); const CopyPlugin = require( 'copy-webpack-plugin' ); const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); module.exports = { ...defaultConfig, entry: async () => ( { ...( typeof defaultConfig.entry === 'function' ? await defaultConfig.entry() : defaultConfig.entry ), 'editor-fields/index': path.resolve( __dirname, 'src/editor-fields/index.js' ), } ), plugins: [ ...defaultConfig.plugins, new CopyPlugin( { patterns: [ { from: path.resolve( __dirname, 'node_modules/altcha/dist/main/altcha.min.js' ), to: 'altcha/altcha.min.js', info: { minimized: true } }, { from: path.resolve( __dirname, 'node_modules/altcha/LICENSE.txt' ), to: 'altcha/LICENSE.txt' }, ], } ), ], };