-
Notifications
You must be signed in to change notification settings - Fork 75
/
webpack.config.js
74 lines (70 loc) · 1.71 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
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlInlineScriptPlugin = require("html-inline-script-webpack-plugin");
const BUILD_ENV = process.env.DBT_DOCS_ENV || "production";
module.exports = {
devtool:
BUILD_ENV == "development" ? "eval-cheap-module-source-map" : "source-map",
entry: "./src/app/index.run.js",
output: {
path: path.resolve(__dirname, "dist"),
},
devServer: {
client: {
overlay: false,
},
static: {
directory: path.resolve(__dirname, "src"),
},
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(BUILD_ENV),
},
}),
new HtmlWebpackPlugin({
template: "./src/index.html",
inlineSource: ".(js|css)$",
}),
new HtmlInlineScriptPlugin(),
],
mode: BUILD_ENV,
module: {
rules: [
{
test: /.*src\/app\/.*\.html$/,
use: [
{
loader:
"ngtemplate-loader?relativeTo=" +
path.resolve(__dirname, "./src/app"),
},
{ loader: "html-loader" },
],
},
{
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
},
{
test: /\.(ttf|eot|woff|woff2)$/,
use: "base64-inline-loader",
},
{
test: /\.svg$/,
loader: "svg-url-loader",
options: {
// Images larger than 10 KB won’t be inlined
limit: 10 * 1024,
noquotes: true,
},
},
{
test: /\.(png|ico|webmanifest)$/,
use: "base64-inline-loader?limit=1000&name=[name].[ext]",
},
],
},
};