-
Notifications
You must be signed in to change notification settings - Fork 54
/
webpack.config.js
57 lines (55 loc) · 1.46 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
process.env.WP_DEVTOOL = false;
const path = require( 'path' );
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
module.exports = {
...defaultConfig,
entry: {
"clipboard": "clipboard",
"react": "react",
"react-dom": "react-dom",
"wp-i18n": "@wordpress/i18n",
"wp-data": "@wordpress/data",
"wp-api-fetch": "@wordpress/api-fetch",
"health-check": [ path.resolve( process.cwd(), 'src/javascript/site-health', 'index.js' ), path.resolve( process.cwd(), 'src/sass', 'health-check.scss' ) ],
"troubleshooting-mode": path.resolve( process.cwd(), 'src/javascript/troubleshooting-mode', 'index.js' ),
},
output: {
filename: '[name].js',
path: path.resolve( process.cwd(), 'health-check/assets/javascript/' ),
},
module: {
rules: [
...defaultConfig.module.rules,
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
}
]
},
plugins: [
new CopyPlugin([
{
from: path.resolve( process.cwd(), 'src/php' ),
to: path.resolve( process.cwd(), 'health-check' )
},
{
from: path.resolve( process.cwd(), 'docs' ),
to: path.resolve( process.cwd(), 'health-check' )
}
]),
new MiniCssExtractPlugin({
filename: '../css/[name].css',
}),
],
externals: {
...defaultConfig.externals,
react: 'React',
'react-dom': 'ReactDOM',
}
};