woocommerce/plugins/woo-ai/webpack.config.js

36 lines
829 B
JavaScript
Raw Normal View History

const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
module.exports = {
...defaultConfig,
entry: {
...defaultConfig.entry,
settings: './src/settings/settings.ts',
},
module: {
...defaultConfig.module,
rules: [
...defaultConfig.module.rules,
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(png|jp(e*)g|svg|gif)$/,
type: 'asset/resource',
},
],
},
resolve: {
extensions: [ '.js', '.jsx', '.tsx', '.ts' ],
},
plugins: [
...defaultConfig.plugins.filter(
( plugin ) =>
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
),
new WooCommerceDependencyExtractionWebpackPlugin(),
],
};