-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
100 lines (99 loc) · 2.25 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = {
entry: "./src/client/Index.tsx",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "bundle"),
},
performance: {
hints: false,
},
mode: process.env.NODE_ENV,
resolve: {
// alias: {
// components: path.resolve(__dirname, 'src/components'),
// },
modules: [__dirname, "./src/client", "node_modules"],
extensions: [".ts", ".tsx", ".js", ".jsx"],
},
module: {
rules: [
// {
// test: /\.ts(x?)$/,
// exclude: /node-modules/,
// use: 'ts-loader',
// },
{
test: /\.ts(x?)$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader",
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
},
},
},
// {
// test: /\.tsx?/,
// exclude: /(node_modules)/,
// use: {
// loader: "babel-loader",
// options: {
// presets: ["@babel/preset-env", "@babel/preset-react"],
// },
// },
// },
{
test: /\.s?[ac]ss$/,
use: [
"style-loader",
"css-loader",
"sass-loader",
],
},
],
},
plugins: [
// must always create a new instance
new HtmlWebpackPlugin({
title: "Development",
// must set the template for the page to render
// check approach on this
template: "./public/index.html",
filename: "bundle.html",
}),
],
devServer: {
host: "localhost",
port: 8080,
static: [
{
directory: path.resolve(__dirname, "./"),
publicPath: "/",
},
{
directory: path.resolve(__dirname, "bundle"),
publicPath: "/",
},
],
hot: true, //Wise words from Lenny: "nice"
proxy: {
"/**": {
target: "http://localhost:3000/",
secure: false,
// changeOrigin: true,
},
// "*": {
// target: "http://localhost:3000/",
// secure: false,
// changeOrigin: true,
// },
},
},
devtool: "eval-source-map",
};