forked from floridahackers/fh-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
84 lines (79 loc) · 1.67 KB
/
Copy pathwebpack.config.js
File metadata and controls
84 lines (79 loc) · 1.67 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
var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractSass = new ExtractTextPlugin({
filename: "styles.css",
disable: process.env.NODE_ENV === "development"
});
const plugins = [
extractSass
];
if (process.env.NODE_ENV === 'production') {
const uglifyPligin = new webpack.optimize.UglifyJsPlugin({ sourceMap: true });
plugins.push(uglifyPligin);
}
var loaders = [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader",
options: {
presets: [
[
"env",
{
targets: { browsers: ["last 2 versions", "safari >= 7"] }
}
],
["react"]
],
plugins: ["transform-object-rest-spread"]
}
}
},
{
test: /\.scss$/,
use: extractSass.extract({
use: [
{
loader: "css-loader"
},
{
loader: "sass-loader"
}
],
// use style-loader in development
fallback: "style-loader"
})
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
];
module.exports = {
devtool: "source-map",
entry: {
home: ["./src/index.js"],
calendar: ["./src/calendar.js"],
addevent: ["./src/add-event.js"],
about: ["./src/about.js"]
},
output: {
path: path.join(__dirname, "/public/dist"),
filename: "[name].bundle.js"
// publicPath: "/dist/",
},
devServer: {
contentBase: path.join(__dirname, "public"),
publicPath: "/dist/"
},
module: {
rules: loaders
},
plugins: plugins
};