-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config-prod.js
More file actions
85 lines (68 loc) · 3.03 KB
/
Copy pathwebpack.config-prod.js
File metadata and controls
85 lines (68 loc) · 3.03 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
import Path from "path";
import Webpack from "webpack";
import ExtractTextPlugin from "extract-text-webpack-plugin";
import Autoprefixer from "autoprefixer";
export default {
// http://webpack.github.io/docs/configuration.html#entry
entry: {
bundle: "./frontend/app",
},
// http://webpack.github.io/docs/configuration.html#output
output: {
// http://webpack.github.io/docs/configuration.html#output-path
path: Path.resolve(__dirname, "public"),
// http://webpack.github.io/docs/configuration.html#output-filename
filename: "[name].js?[chunkhash]",
chunkFilename: "[name].js?[chunkhash]",
// http://webpack.github.io/docs/configuration.html#output-publicpath
publicPath: "/",
// http://webpack.github.io/docs/configuration.html#output-pathinfo
pathinfo: false,
},
// http://webpack.github.io/docs/configuration.html#debug
debug: false,
// http://webpack.github.io/docs/configuration.html#devtool
devtool: null,
// http://webpack.github.io/docs/configuration.html#profile
profile: false,
// http://webpack.github.io/docs/configuration.html#module
module: {
// http://webpack.github.io/docs/loaders.html
loaders: [
// https://github.com/babel/babel-loader
{test: /\.(js(\?.*)?)$/, loaders: ["babel?stage=0"], exclude: /node_modules/},
// https://github.com/webpack/json-loader
{test: /\.(json(\?.*)?)$/, loaders: ["json"]},
// https://github.com/webpack/css-loader
{test: /\.(css(\?.*)?)$/, loader: ExtractTextPlugin.extract("css!postcss")},
// https://github.com/webpack/less-loader
{test: /\.(less(\?.*)?)$/, loader: ExtractTextPlugin.extract("css!postcss!less")},
// https://github.com/webpack/url-loader
{test: /\.(jpg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(jpeg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(png(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(gif(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(svg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(ttf(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(woff(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(woff2(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(eot(\?.*)?)$/, loaders: ["url?limit=10000"]},
],
},
// https://github.com/postcss/autoprefixer
postcss: [Autoprefixer()],
// http://webpack.github.io/docs/configuration.html#resolve
resolve: {
// http://webpack.github.io/docs/configuration.html#resolve-root
root: Path.resolve("./frontend"),
// http://webpack.github.io/docs/configuration.html#resolve-modulesdirectories
modulesDirectories: ["node_modules"],
},
// http://webpack.github.io/docs/list-of-plugins.html
plugins: [
new ExtractTextPlugin("[name].css?[contenthash]", {allChunks: true}),
new Webpack.optimize.DedupePlugin(),
new Webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}),
new Webpack.optimize.UglifyJsPlugin({mangle: {except: ["$", "window", "document", "console"]}}),
],
};