const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const path = require( 'path' );

const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
	...defaultConfig,
	entry: {
		'admin/index': path.resolve( __dirname, 'src/admin/index.js' ),
	},
	output: {
		...defaultConfig.output,
		path: path.resolve( __dirname, 'build' ),
	},
	devtool: isProduction ? false : 'source-map',
	resolve: {
		...defaultConfig.resolve,
		alias: {
			...( defaultConfig.resolve && defaultConfig.resolve.alias ? defaultConfig.resolve.alias : {} ),
			'@rawtype/ui': path.resolve( __dirname, '../../../', 'shared', 'ui' ),
		},
		modules: [
			path.resolve( __dirname, 'node_modules' ),
			'node_modules',
		],
	},
};
