-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.config.js
More file actions
85 lines (75 loc) · 1.77 KB
/
Copy pathwebpack.config.js
File metadata and controls
85 lines (75 loc) · 1.77 KB
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
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
entry: [
'./source/index.js'
],
output: {
filename: 'build.js',
path: __dirname + '/build'
},
devServer: {
contentBase: './build',
hot: true
},
module: {
loaders: [
// JSON.
{
test: /\.json$/,
loader: 'json-loader',
exclude: /node_modules/
},
// JavaScript.
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
// CSS.
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?minimize&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss-loader'
)
},
// SVG.
{
test: /\.svg$/,
loader: 'url-loader?limit=20000&mimetype=image/svg+xml'
},
// Images.
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=20000&name=[name]_[sha512:hash:base64:7].[ext]'
}
]
},
postcss: [
require('autoprefixer-core')
],
resolve: {
modulesDirectories: [
'node_modules',
'components'
]
},
plugins: [
new ExtractTextPlugin('build.css', {
allChunks: true
}),
/*
This adds the `window.fetch` Ajax helper.
Documentation here:
https://github.com/github/fetch
*/
new webpack.ProvidePlugin({
'Promise': 'imports?this=>global!exports?global.Promise!es6-promise',
'window.Promise': 'imports?this=>global!exports?global.Promise!es6-promise',
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch',
'window.fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
})
]
}