-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
57 lines (56 loc) · 1.43 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
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
context: path.resolve(__dirname, "./src"),
devServer: {
contentBase: path.resolve(__dirname, "."),
port: 3000
},
devtool: "source-map",
entry: ["babel-polyfill", "./index.js"],
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: "babel-loader",
options: { presets: ["es2015", "stage-0"] }
}]
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
loader: "css-loader?importLoaders=1"
})
}
]
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "./build"),
publicPath: ""
},
plugins: [
new ExtractTextPlugin({
filename: "[name].css",
allChunks: true
}),
new HtmlWebpackPlugin({
title: "hite",
hash: true
}),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: function (module) {
return module.context && module.context.indexOf("node_modules") !== -1;
}
}),
new webpack.optimize.CommonsChunkPlugin({
// But since there are no more common modules between them we end up with just the runtime code included in the manifest file
name: "manifest"
})
]
};