-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
52 lines (51 loc) · 1.53 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
// webpack.config.js
var path = require('path'),
webpack_entry = require('./src/configs/webpack-entries'),
miniCssExtractPlugin = require('mini-css-extract-plugin'),
webpack = require('webpack'),
env = require('dotenv').config();
module.exports = {
entry: webpack_entry,
output: {
path: path.join(__dirname, 'public', 'build', 'dist'),
filename: '[name].js',
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
new miniCssExtractPlugin({ filename: '[name].css' }),
],
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
miniCssExtractPlugin.loader,
'css-loader',
],
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000',
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
stats: {
colors: true,
},
devtool: process.env.NODE_ENV == 'debugging' ? 'source-map' : false,
mode:
process.env.NODE_ENV == 'production' ||
process.env.NODE_ENV == 'staging'
? 'production'
: 'development',
//travis ci uses NODE_ENV='staging', if set to 'production' it will not install devDependencies - which are required for building including 'webpack'
};