This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
webpack.config.perf.ts
74 lines (69 loc) · 1.85 KB
/
webpack.config.perf.ts
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
import * as CopyWebpackPlugin from 'copy-webpack-plugin'
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
import { webpack as lernaAliases } from 'lerna-alias'
import { argv } from 'yargs'
import config from '../config'
const { paths } = config
const webpackConfig: any = {
name: 'client',
target: 'web',
mode: 'development',
entry: {
app: paths.perfSrc('index'),
},
output: {
filename: `[name].js`,
path: paths.perfDist(),
pathinfo: true,
publicPath: config.compiler_public_path,
},
devtool: config.compiler_devtool,
node: {
fs: 'empty',
module: 'empty',
child_process: 'empty',
net: 'empty',
readline: 'empty',
},
module: {
noParse: [/anchor-js/],
rules: [
{
test: /\.(js|ts|tsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
cacheDirectory: true,
},
},
],
},
plugins: [
new ForkTsCheckerWebpackPlugin({ tsconfig: paths.base('build/tsconfig.perf.json') }),
new CopyWebpackPlugin([
{
from: paths.perfSrc('index.html'),
to: paths.perfDist(),
},
]),
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
...lernaAliases(),
docs: paths.base('docs'),
src: paths.packageSrc('react'),
// We are using React in production mode with tracing.
// https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
},
},
performance: {
hints: false, // to (temporarily) disable "WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit")
},
optimization: {
nodeEnv: !!argv.debug ? 'development' : 'production',
},
}
export default webpackConfig