-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (40 loc) · 1.2 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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const webpack = require("webpack");
const BASE_DIRECTORY = __dirname + "";
const isDevelopment = process.env.NODE_ENV !== 'production';
console.log(isDevelopment ? "DEVELOPMENT" : "PRODUCTION");
module.exports = {
entry: [`${BASE_DIRECTORY}/src/index.tsx`],
mode: isDevelopment ? "development" : "production",
target: "web",
output: {
path: `${BASE_DIRECTORY}/public/`,
filename: 'bundle.js',
},
resolve: {
extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],
},
devServer: {
contentBase: `${BASE_DIRECTORY}/public/`,
compress: true,
port: 3000,
hot: true
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
loader: "ts-loader",
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: `${BASE_DIRECTORY}/public/index.html`
}),
new ForkTsCheckerWebpackPlugin(),
isDevelopment && new webpack.HotModuleReplacementPlugin(),
].filter(Boolean)
}