-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
68 lines (68 loc) · 1.61 KB
/
webpack.common.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
58
59
60
61
62
63
64
65
66
67
68
const path = require( 'path' );
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
const combineLoaders = require( 'webpack-combine-loaders' );
const autoprefixer = require( 'autoprefixer' );
const externals = {
jquery: 'jQuery',
'@eventespresso/eejs': 'eejs',
'@eventespresso/i18n': 'eejs.i18n',
};
/** see below for multiple configurations.
/** https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations */
const config = [
{
configName: 'base',
entry: {
//@todo this is where bundles will go for builds
},
externals,
output: {
filename: 'ee-[name].[chunkhash].dist.js',
path: path.resolve( __dirname, 'assets/dist' ),
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
combineLoaders( [
{
loader: 'css-loader',
query: {
modules: true,
localIdentName: '[local]',
},
//can't use minimize because cssnano (the
// dependency) doesn't parser the browserlist
// extension in package.json correctly, there's
// a pending update for it but css-loader
// doesn't have the latest yet.
// options: {
// minimize: true
// }
},
{
loader: 'postcss-loader',
options: {
plugins: function() {
return [ autoprefixer ];
},
sourceMap: true,
},
},
] ),
),
},
],
},
watchOptions: {
poll: 1000,
},
},
];
module.exports = config;