This repository was archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
58 lines (50 loc) · 1.41 KB
/
webpack.config.js
File metadata and controls
58 lines (50 loc) · 1.41 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
const webpack = require("webpack");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
const DIST = "dist";
console.log(process.env.DEV ? "DEV Mode" : "Production Mode");
const plugins = [
new webpack.DefinePlugin({
API_BASE_URL: JSON.stringify(process.env.DEV ? "http://localhost:5000" : "https://api.offenesparlament.de"),
}),
];
if (!process.env.DEV) {
plugins.push(new UglifyJSPlugin({
mangle: false,
sourceMap: true,
}));
}
module.exports = {
entry: {
main: "./app/main.js"
},
output: {
path: path.join(__dirname, DIST),
filename: "[name].js"
},
module: {
loaders: [{
test: /\.js$/,
loader: "buble-loader"
}, {
test: /\.html/,
loader: "html-loader"
}, {
test: /\.scss$/,
loader: "style-loader!css-loader?minimize=true!sass-loader"
}, {
test: /\.css/,
loader: "style-loader!css-loader?minimize=true"
}, {
test: /\.(png|svg|jpg)$/,
loader: "file-loader?name=[path][name].[ext]&context=./scripts"
}, {
test: /\.(eot|woff|woff2|ttf)$/,
loader: "file-loader?name=[path][name].[ext]&context=./scripts"
}, {
test: /\.json$/,
loader: "json-loader"
}],
},
plugins: plugins,
};