-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (57 loc) · 1.44 KB
/
webpack.config.js
File metadata and controls
60 lines (57 loc) · 1.44 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
57
58
59
60
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const path = require("path");
const isProductionMode = process.env.NODE_ENV === "production";
/**
* Windows specific error handling
*/
process.on("uncaughtException", function(err) {
console.error(err.stack);
});
module.exports = {
entry: {
app: ["./src/app.tsx"],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: "./src/index.ejs",
filename: "index.html",
}),
],
mode: isProductionMode ? "production" : "development",
// The default "eval" value causes warnings about node_modules' source maps in
// Chrome Dev Tools console.
devtool: !isProductionMode
? "eval-cheap-source-map"
: "hidden-source-map",
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loader: "ts-loader",
options: {
context: __dirname,
configFile: "tsconfig.json",
},
},
],
},
output: {
publicPath: "/",
path: path.join(__dirname, "dist"),
filename: "react-static/js/[name].[chunkhash].js",
chunkFilename: "react-static/js/[name].[chunkhash].js",
},
resolve: {
symlinks: false,
extensions: [".js", ".json", ".ts", ".tsx"],
},
devServer: {
host: "127.0.0.1",
port: "3000",
contentBase: path.join(__dirname, "dist"),
historyApiFallback: true,
}
};