-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.client.js
40 lines (39 loc) · 1015 Bytes
/
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
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = isProduction => ({
devtool: isProduction ? "source-map" : "eval",
mode: isProduction ? "production" : "development",
entry: {
client: path.resolve(__dirname, "src/client.ts")
},
output: {
path: path.resolve(__dirname, "dist"),
publicPath: "/assets/",
filename: isProduction ? "js/[name].[chunkhash:10].js" : "js/[name].js"
},
plugins: isProduction && [
new MiniCssExtractPlugin({
filename: "css/[name].[contenthash:10].css"
})
],
module: {
rules: [
{
test: /\.tsx?$/,
include: [path.resolve(__dirname, "src")],
use: ["ts-loader"]
},
{
test: /\.css$/,
include: [path.resolve(__dirname, "src")],
use: [
isProduction ? MiniCssExtractPlugin.loader : "style-loader",
"css-loader"
]
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
}
});