40 lines
855 B
JavaScript
40 lines
855 B
JavaScript
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
|
|
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
|
|
|
|
module.exports = {
|
|
...defaultConfig,
|
|
entry: {
|
|
index: './src/index.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' ],
|
|
fallback: {
|
|
stream: false,
|
|
path: false,
|
|
fs: false,
|
|
},
|
|
},
|
|
plugins: [
|
|
...defaultConfig.plugins.filter(
|
|
( plugin ) =>
|
|
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
|
|
),
|
|
new WooCommerceDependencyExtractionWebpackPlugin(),
|
|
],
|
|
};
|