-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
59 lines (57 loc) · 1.77 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
58
59
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBM Corporation 2018, 2019
*/
const debug = process.env.NODE_ENV !== 'production';
const webpack = require('webpack');
const path = require('path');
module.exports = {
devtool: debug ? 'inline-sourcemap' : false,
entry: path.join(__dirname, 'src/index.js'),
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
include: [
path.join(__dirname, 'src'),
],
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
},
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
{
test: /\.(png|jpg|svg)$/,
loader: 'url-loader?limit=1&name=img/[name].[ext]',
},
],
},
output: {
path: path.join(__dirname, 'src'),
filename: 'app.min.js',
},
plugins: debug ? [] : [
new webpack.DefinePlugin({
'process.env.REACT_SYNTAX_HIGHLIGHTER_LIGHT_BUILD': true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new webpack.optimize.UglifyJsPlugin({
mangle: true,
sourcemap: false,
compress: {
screw_ie8: true,
warnings: false,
},
}),
],
};