-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.client.config.js
46 lines (43 loc) · 1.29 KB
/
webpack.client.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// const ReactServerWebpackPlugin = require('react-server-dom-webpack/plugin');
const ReactServerWebpackPlugin = require('./plugin/ReactFlightWebpackPlugin')
.default;
// const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
const cwd = process.cwd();
module.exports = {
context: path.resolve(cwd, './'),
mode: isProduction ? 'production' : 'development',
devtool: isProduction ? 'source-map' : 'cheap-module-source-map',
entry: [path.resolve(__dirname, './src/index.client.tsx')],
output: {
path: path.resolve(__dirname, './build'),
filename: 'main.js',
pathinfo: false,
futureEmitAssets: true,
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json', '.mjs'],
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)?$/,
// use: 'babel-loader',
use: ['babel-loader?cacheDirectory'],
exclude: /node_modules/,
},
],
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, './public/index.html'),
}),
// new ReactRefreshPlugin(),
new ReactServerWebpackPlugin({
isServer: false,
}),
],
};