-
Notifications
You must be signed in to change notification settings - Fork 18
/
webpack.config.js
74 lines (63 loc) · 1.67 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
/*
* Copyright (c) 2022, Quansight
*
* 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 webpack = require("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 = {
devServer: {
port: 8000,
},
devtool: isProd ? false : "source-map",
entry: ["src/index.tsx", "src/main.tsx"],
watch: false,
...getContext(__dirname),
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
publicPath: "/"
},
module: {
rules: [
...dependencySrcMapRules,
...stylingRules,
...svgUrlRules,
...tsRules,
]
},
resolve: {
...getResolve(__dirname)
},
plugins: [
new HtmlWebpackPlugin({
title: "conda-store"
}),
new MiniCssExtractPlugin(),
new Dotenv(),
new webpack.EnvironmentPlugin(['REACT_APP_VERSION'])
],
mode: isProd ? "production" : "development",
optimization: {
minimize: isProd,
...(isProd && getOptimization())
}
};
module.exports = [basicConfig];