-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
57 lines (53 loc) · 1.64 KB
/
Copy pathwebpack.config.js
File metadata and controls
57 lines (53 loc) · 1.64 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
const webpack = require("webpack");
const path = require("path");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const SRC_DIR = path.resolve(__dirname, "public/src");
const BUILD_DIR = path.resolve(__dirname, "public/prod");
const extractAdminCss = new ExtractTextPlugin({
filename: "../stylesheets/adminStyle.css",
allChunks: true
});
const extractMainCss = new ExtractTextPlugin({
filename: "../stylesheets/mainStyle.css",
allChunks: true
});
const config = {
entry: {
challenge: [
SRC_DIR + "/javascripts/challenge.js",
SRC_DIR + "/stylesheets/_mainBundle.sass"
],
admin: [SRC_DIR + "/javascripts/admin.js", SRC_DIR + "/stylesheets/_adminBundle.sass"],
search: SRC_DIR + "/javascripts/search.js"
},
output: {
path: BUILD_DIR + "/javascripts",
filename: "[name]Bundle.js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: {
presets: ["env", "react"]
}
}
]
},
{
test: /_adminBundle\.sass/,
loader: extractAdminCss.extract(["css-loader", "sass-loader"])
},
{
test: /_mainBundle\.sass/,
loader: extractMainCss.extract(["css-loader", "sass-loader"])
}
]
},
plugins: [extractAdminCss, extractMainCss]
};
module.exports = config;