-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
37 lines (34 loc) · 935 Bytes
/
webpack.config.js
File metadata and controls
37 lines (34 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RtlCssPlugin = require('rtlcss-webpack-plugin');
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const plugins = defaultConfig.plugins.filter(
(plugin) => plugin?.constructor?.name !== 'RtlCssPlugin'
);
plugins.push(
new RtlCssPlugin({
filename: 'panel-rtl.css',
})
);
module.exports = {
...defaultConfig,
entry: {
panel: path.resolve(__dirname, 'src/panel/index.jsx'),
},
output: {
...defaultConfig.output,
path: path.resolve(__dirname, 'assets'),
filename: 'panel.js',
},
optimization: {
...defaultConfig.optimization,
splitChunks: false,
runtimeChunk: false,
},
plugins: plugins.map((plugin) => {
if (plugin instanceof MiniCssExtractPlugin) {
return new MiniCssExtractPlugin({ filename: 'panel.css' });
}
return plugin;
}),
};