forked from italia/design-web-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
94 lines (84 loc) · 1.85 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
var webpack = require('webpack')
var path = require('path')
var libraryName = 'IWT'
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin
// var env = process.env.WEBPACK_ENV
var plugins = []
var loaders = []
if ('dev' !== process.env.WEBPACK_ENV) {
plugins.push(new UglifyJsPlugin({
minimize: true,
sourceMap: true
}))
}
plugins.push(
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /it/)
)
loaders.push({
test: /\.png/,
loader: 'url-loader?limit=100000&minetype=image/png'
})
loaders.push({
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
]
})
// var ExtractTextPlugin = require('extract-text-webpack-plugin')
//
// loaders.push({
// test: /\.css$/,
// use: ExtractTextPlugin.extract({
// fallback: 'style-loader',
// use: 'css-loader'
// })
// })
//
// plugins.push(new ExtractTextPlugin({
// filename: 'vendor.css'
// }))
plugins.push(new webpack.LoaderOptionsPlugin({
debug: true
}))
var config = {
entry: {
IWT: __dirname + '/index.js',
styleguide: __dirname + '/theme/index-styleguide.js'
},
devtool: 'source-map',
output: {
path: __dirname + '/build',
filename: '[name].min.js',
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true,
publicPath: process.env.PUBLIC_PATH || '',
chunkFilename: '[name].chunk.js'
},
externals: {
'jquery': 'jQuery',
'$': 'jQuery',
},
module: {
rules: [...loaders, {
test: /(\.jsx|\.js)$/,
loader: 'babel-loader',
exclude: /(pikaday)/,
// exclude: /(node_modules|bower_components)/
}, {
test: /(\.jsx|\.js)$/,
loader: 'eslint-loader',
exclude: /node_modules/
}]
},
resolve: {
modules: [
path.resolve('./src'),
path.resolve('./theme'),
'node_modules'
]
},
plugins: plugins,
}
module.exports = config