-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.client.js
78 lines (77 loc) · 2.22 KB
/
webpack.client.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
const path = require("path");
const webpack = require("webpack");
const {TypedCssModulesPlugin} = require("typed-css-modules-webpack-plugin");
module.exports = {
entry: ["@babel/polyfill", "./src/client.tsx"],
mode: "development",
output: {
filename: "bundle.client.js",
path: path.resolve(__dirname, "./build/static"),
},
module: {
rules: [
{
test: /\.(js|(j|t)sx?)$/,
loader: "babel-loader",
exclude: /node_modules/,
options: {
presets: [
"@babel/react",
"@babel/preset-typescript",
[
"@babel/env",
{
targets: {
browsers: ["last 2 versions"],
},
},
],
],
},
},
{
test: /\.css$/,
use: [
"isomorphic-style-loader",
{
loader: "css-loader",
options: {
esModule: false,
importLoaders: 1,
},
},
"postcss-loader",
// "typings-for-css-modules-loader?modules",
],
},
],
},
plugins: [
new TypedCssModulesPlugin({
globPattern: "src/**/*.css",
}),
new webpack.HotModuleReplacementPlugin(),
],
devServer: {
static: path.join(__dirname, "build"),
compress: true,
port: 3000,
watchFiles: [
"src/actions/*",
"src/components/*",
"src/pages/*",
"src/reducer/*",
"src/typeScript/*",
"src/utils/*",
"src/App.tsx",
"src/App.module.css",
"public/**/*",
],
hot: true,
open: true,
historyApiFallback: true,
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".css"],
},
};