forked from makeorbreak-io/mob-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.production.babel.js
69 lines (55 loc) · 1.83 KB
/
webpack.config.production.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
const Webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
const { NODE_ENV } = process.env;
module.exports = {
target: "web",
context: path.resolve(__dirname, "src"),
devtool: "source-map",
entry: [
path.resolve(__dirname, "src", "index.js"),
],
output: {
path: path.resolve(__dirname, "build"),
filename: "[name].bundle.js",
publicPath: "/",
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, use: "eslint-loader", enforce: "pre" },
{ test: /\.js$/, exclude: /node_modules/, use: [ "react-hot-loader/webpack", "babel-loader" ] },
{ test: /\.json$/, use: "json-loader" },
{ test: /\.css$/, use: [ "style-loader", "css-loader" ] },
{ test: /\.styl$/, use: [ "style-loader", "css-loader", { loader: "postcss-loader", options: { sourceMap: true} }, "stylus-loader" ] },
{ test: /\.svg$/, use: [ "file-loader", "svgo-loader" ] },
{ test: /\.(jpe?g|png|gif)$/i, use: [ "url-loader?limit=10000", "img-loader" ] },
],
},
resolve: {
modules: [ path.resolve(__dirname, "src"), "node_modules" ],
extensions: [ ".js", ".json", ".styl", ".css" ],
},
plugins: [
// Global implicit imports
new Webpack.ProvidePlugin({
Promise: "bluebird",
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "src", "index.html"),
}),
new FaviconsWebpackPlugin({
logo: path.resolve(__dirname, "assets", "favicon.png"),
title: "Make or Break",
}),
new Webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify(NODE_ENV),
},
}),
new UglifyJSPlugin({
sourceMap: true,
}),
],
};