forked from WebDevStudios/constant-contact-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
57 lines (55 loc) · 1.37 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
/**
* Webpack Config
*
* @package ConstantContactForms
*/
const pluginConfig = require( './plugin-config' );
const isProduction = 'production' === process.env.NODE_ENV;
const host = isProduction ? pluginConfig.localURL : pluginConfig.watchURL;
const config = {
mode: isProduction ? 'production' : 'development',
entry: {
'ctct-plugin-admin': [ './assets/js/ctct-plugin-admin/index.js' ],
'ctct-plugin-gutenberg': [ './assets/js/ctct-plugin-gutenberg/index.js' ],
'ctct-plugin-frontend': [ './assets/js/ctct-plugin-frontend/index.js' ],
'ctct-plugin-recaptcha': [ './assets/js/ctct-plugin-recaptcha/index.js' ],
'ctct-plugin-recaptcha-v2': [ './assets/js/ctct-plugin-recaptcha-v2/index.js' ]
},
output: {
filename: isProduction ? '[name].min.js' : '[name].js',
publicPath: host + pluginConfig.publicJS
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
'targets': {
'browsers': [ 'last 2 versions', 'ie 11' ]
}
}
],
'@babel/preset-react'
]
}
}
}
]
},
plugins: [],
devtool: isProduction ? 'source-map' : 'cheap-module-eval-source-map',
externals: {
$: 'jQuery',
jQuery: 'jQuery',
jquery: 'jQuery',
lodash: 'lodash'
}
};
module.exports = config;