forked from jsliang/jira-story-points-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
68 lines (65 loc) · 1.54 KB
/
webpack.config.babel.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
import CopyWebpackPlugin from 'copy-webpack-plugin';
import webpack from 'webpack';
const NODE_ENV = process.env.NODE_ENV || 'development';
const IS_PRODUCTION = NODE_ENV === 'production';
const config = {
entry: {
index: ['./src/index.js'],
},
output: {
path: IS_PRODUCTION ? `${__dirname}/dist` : `${__dirname}/build`,
filename: '[name].js',
},
plugins: [
new CopyWebpackPlugin([
{ from: './src/_locales', to: '_locales' },
{ from: './src/icon.png' },
{ from: './src/manifest.json' },
]),
new webpack.optimize.UglifyJsPlugin({
beautify: !IS_PRODUCTION,
comments: !IS_PRODUCTION,
compress: IS_PRODUCTION ? { warnings: false } : false,
mangle: IS_PRODUCTION,
sourceMap: !IS_PRODUCTION,
}),
new webpack.LoaderOptionsPlugin({
debug: !IS_PRODUCTION,
}),
],
devtool: IS_PRODUCTION ? 'cheap-source-map' : 'eval',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules|build|dist/,
use: [
{
loader: 'babel-loader',
query: {
cacheDirectory: true,
cacheIdentifier: true,
},
},
],
},
{
test: /\.png$/,
use: [
{
loader: 'url-loader',
query: {
limit: 10000,
mimetype: 'image/png',
},
},
],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
modules: ['src', 'node_modules'],
},
};
module.exports = config;