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

module.exports = {
    ...defaultConfig,
    module: {
        ...defaultConfig.module,
        rules: defaultConfig.module.rules.map(rule => {
            if (rule.test?.toString().includes('.css$')) {
                return {
                    ...rule,
                    exclude: /node_modules/,
                    use: [
                        'style-loader',
                        {
                            loader: 'css-loader',
                            options: {
                                sourceMap: true,
                                import: true
                            }
                        }
                    ]
                };
            }
            return rule;
        })
    },
    watchOptions: {
        ignored: /node_modules/,
        aggregateTimeout: 300,
        poll: 1000
    }
}; 