-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·39 lines (34 loc) · 1.06 KB
/
webpack.config.js
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
38
39
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const rtlCssPlugin = require( 'rtlcss-webpack-plugin' );
const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' );
const path = require( 'path' );
const entry = defaultConfig.entry();
entry.index = path.resolve( `${ process.env.WP_SRC_DIRECTORY }/index.js` );
const reactConfig = {
...defaultConfig,
entry,
plugins: [
...defaultConfig.plugins,
new rtlCssPlugin( {filename: `[name]-rtl.css`} ),
],
};
const assetsConfig = {
...defaultConfig,
entry: {
'admin': ['./assets/src/js/admin.js', './assets/src/scss/admin.scss'],
'cartick': ['./assets/src/js/cartick.js', './assets/src/scss/cartick.scss']
},
output: {
...defaultConfig.output,
filename: './js/[name].js',
path: path.resolve( process.cwd(), 'assets/dist' ),
},
plugins: [
new MiniCSSExtractPlugin(
{
filename: "./css/[name].css"
}
),
]
}
module.exports = [reactConfig, assetsConfig];