-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
42 lines (36 loc) · 1007 Bytes
/
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
const path = require('path');
const merge = require("webpack-merge");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const parts = require("./webpack.parts");
const commonConfig = merge([
{
plugins: [
new HtmlWebpackPlugin({
title: "Dynamic glyph in lottie-web",
template: "index.html"
}),
],
node: {
fs: "empty",
}
},
parts.loadCSS(),
parts.loadJavaScript({ include: [path.resolve(__dirname, 'src')], exclude: /(node_modules)/ }),
parts.loadSnapSVG(),
parts.loadFontkit(),
parts.loadWebfont({ include: [path.resolve(__dirname, 'src')] }),
]);
const productionConfig = merge([]);
const developmentConfig = merge([
parts.devServer({
// Customize host/port here if needed
host: process.env.HOST,
port: process.env.PORT,
}),
]);
module.exports = mode => {
if (mode === "production") {
return merge(commonConfig, productionConfig, { mode });
}
return merge(commonConfig, developmentConfig, { mode });
};