forked from conda-incubator/conda-store-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
80 lines (67 loc) · 1.84 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
/*
* Copyright (c) 2020, Max Klein
*
* This file is part of the tree-finder library, distributed under the terms of
* the BSD 3 Clause license. The full license can be found in the LICENSE file.
*/
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const Dotenv = require("dotenv-webpack");
// const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
// To improve build times for large projects enable fork-ts-checker-webpack-plugin
// const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const {
dependencySrcMapRules,
stylingRules,
svgUrlRules,
getContext,
getOptimization,
getResolve,
tsRules
} = require("./webpack.rules");
const isProd = process.env.NODE_ENV === "production";
const basicConfig = {
devtool: isProd ? false : "source-map",
entry: ["src/index.tsx", "src/AppExample.tsx"],
watch: false,
...getContext(__dirname),
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js"
},
module: {
rules: [
...dependencySrcMapRules,
...stylingRules,
...svgUrlRules,
...tsRules
]
},
resolve: {
...getResolve(__dirname)
},
// devServer: {
// contentBase: [path.join(__dirname, "examples"), path.join(__dirname, ".")],
// inline: false,
// publicPath: "/csui/",
// dev-server writes to disk instead of keeping the bundle in memory
// writeToDisk: true,
// allowedHosts: [
// 'demo.nebari.dev'
// ]
// },
plugins: [
new HtmlWebpackPlugin({
title: "conda-store"
}),
new MiniCssExtractPlugin(),
new Dotenv()
],
mode: isProd ? "production" : "development",
optimization: {
minimize: isProd,
...(isProd && getOptimization())
}
};
module.exports = [basicConfig];