2023-06-08 20:20:05 +00:00
|
|
|
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
|
|
|
|
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
|
2024-07-29 13:20:17 +00:00
|
|
|
const path = require( 'path' );
|
2023-06-08 20:20:05 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
...defaultConfig,
|
|
|
|
entry: {
|
2023-10-26 10:25:11 +00:00
|
|
|
index: './src/index.ts',
|
2023-06-08 20:20:05 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
...defaultConfig.module,
|
|
|
|
rules: [
|
|
|
|
...defaultConfig.module.rules,
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader',
|
2024-07-29 13:20:17 +00:00
|
|
|
include: [ path.resolve( __dirname, './src/' ) ],
|
2023-06-08 20:20:05 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jp(e*)g|svg|gif)$/,
|
|
|
|
type: 'asset/resource',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: [ '.js', '.jsx', '.tsx', '.ts' ],
|
2023-09-06 10:36:14 +00:00
|
|
|
fallback: {
|
|
|
|
stream: false,
|
|
|
|
path: false,
|
|
|
|
fs: false,
|
|
|
|
},
|
2023-06-08 20:20:05 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
...defaultConfig.plugins.filter(
|
|
|
|
( plugin ) =>
|
|
|
|
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
|
|
|
|
),
|
|
|
|
new WooCommerceDependencyExtractionWebpackPlugin(),
|
|
|
|
],
|
|
|
|
};
|