-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
73 lines (70 loc) · 1.79 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const ExtractTextPlugin = require("extract-text-webpack-plugin"),
path = require("path"),
webpack = require("webpack"),
HtmlWebpackPlugin = require("html-webpack-plugin");
indexJs = path.resolve(__dirname, "./lib/index.js");
module.exports = {
"index": indexJs,
"entry": ["babel-polyfill", indexJs],
"devtool": "eval-source-map",
"output": {
"path": path.resolve(__dirname, "dist"),
"filename": "js/bundle[hash].js"
},
"module": {
"loaders": [
{
"test": /\.jsx?$/,
"loader": "babel", "exclude": /node_modules/
},
{
"test": /\.scss$/,
"loader": ExtractTextPlugin.extract(["style-loader"], "css-loader!postcss-loader!sass-loader")
},
{
"test": /\.css$/,
"loader": "style-loader!css-loader!postcss-loader"
},
{
"test": /\.(jp?g|png|gif|svg)$/,
"loader": "file?name=[path][name].[ext]",
"include": path.resolve(__dirname, "images/")
},
{
"test": /\.(woff|woff2|eot|ttf|svg)$/,
"loader": "url-loader?limit=100000&name=fonts/[name][hash].[ext]"
}
]
},
"postcss": () => {
return [
require("postcss-cssnext")({
browsers: ["last 2 versions"],
warnForDuplicates: false
}),
require("postcss-discard-duplicates"),
require("postcss-discard-comments"),
require("cssnano")({
zindex: false
})
];
},
"plugins": [
new HtmlWebpackPlugin({
template: path.join(__dirname, "index.ejs"),
path: __dirname,
filename: "index.html",
pkg: require("./package.json"),
inject: false,
favicon: "favicon.ico",
minify: false
}),
// Ignore all other locals except [en]
// (https://webpack.js.org/plugins/context-replacement-plugin/)
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new ExtractTextPlugin("[name][hash].css"),
new webpack.ProvidePlugin({
"React": "react"
})
]
};