-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack.config.js
65 lines (62 loc) · 1.42 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
var webpack = require("webpack");
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var UglifyJsPlugin = require("uglifyjs-webpack-plugin");
var FaviconsWebpackPlugin = require('favicons-webpack-plugin')
var fs = require("fs");
var src = path.resolve(__dirname, "src");
var out = path.resolve(__dirname, "debug");
var config = {
entry: ["babel-polyfill", src + "/jsx/index.jsx"],
output: {
path: out + "/js",
publicPath: "/",
filename: "bundle.js"
},
module: {
rules: [
{
test: /\.jsx?/,
use: ["babel-loader"],
exclude: /node_modules/
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
use: ["url-loader?limit=1024"]
},
{
test: /\.(png|jpg|ico)$/,
use: ["url-loader?limit=8192"]
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.svg$/,
exclude: /node_modules/,
use: ['svg-react-loader']
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: src + "/templates/index.html"
}),
new FaviconsWebpackPlugin(src +'/img/logo-small.png')
],
optimization: {
minimizer: [
new UglifyJsPlugin({
sourceMap: true,
uglifyOptions: { ecma: 8 }
})
]
},
devServer: {
contentBase: out,
port: 9000,
historyApiFallback: true
}
};
module.exports = config;