forked from thechangelog/changelog.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
109 lines (107 loc) · 2.59 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var webpack = require("webpack");
var merge = require("webpack-merge");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var common = {
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/, /semantic/, /uploads/],
loader: "babel-loader",
options: {
presets: ["es2015"]
}
},
{
test: /\.hbs$/,
loader: "handlebars-loader"
},
{
test: [/\.sass$/, /\.css$/],
loader: ExtractTextPlugin.extract({use: "css-loader!sass-loader", fallback: "style-loader"})
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: "file-loader?name=/images/[name].[ext]"
},
{
test: /\.(ttf|eot|svg|woff2?)$/,
loader: "file-loader?name=/fonts/[name].[ext]",
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {warnings: false},
output: {comments: false}
})
]
};
module.exports = [
merge(common, {
entry: [
"normalize.css",
__dirname + "/web/static/app/app.sass",
__dirname + "/web/static/app/app.js"
],
output: {
path: __dirname + "/priv/static",
filename: "js/app.js"
},
resolve: {
modules: [
"node_modules",
__dirname + "/web/static/app"
]
},
plugins: [
new CopyWebpackPlugin([{ from: __dirname + "/web/static/assets"}]),
new ExtractTextPlugin("css/app.css")
]
}),
merge(common, {
entry: [
"normalize.css",
__dirname + "/web/static/app/embed.sass",
__dirname + "/web/static/app/embed.js"
],
output: {
path: __dirname + "/priv/static",
filename: "js/embed.js"
},
resolve: {
modules: [
"node_modules",
__dirname + "/web/static/app"
]
},
plugins: [
new ExtractTextPlugin("css/embed.css")
]
}),
merge(common, {
entry: [
__dirname + "/web/static/semantic/semantic.css",
__dirname + "/web/static/semantic/semantic.js",
__dirname + "/web/static/semantic/calendar.css",
__dirname + "/web/static/semantic/calendar.js",
__dirname + "/web/static/admin/admin.css",
__dirname + "/web/static/admin/admin.js"
],
output: {
path: __dirname + "/priv/static",
filename: "js/admin.js"
},
resolve: {
modules: [
"node_modules",
__dirname + "/web/static/admin"
]
},
plugins: [
new webpack.ProvidePlugin({$: "jquery", jQuery: "jquery"}),
new ExtractTextPlugin("css/admin.css")
]
})
];