Skip to content

Commit 051bff9

Browse files
committed
Refactor: speed up build
1 parent 3288cdc commit 051bff9

File tree

3 files changed

+4569
-4973
lines changed

3 files changed

+4569
-4973
lines changed

packages/hedgehog-lab/config-overrides.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,44 @@ const {
44
getBabelLoader,
55
addWebpackPlugin,
66
addWebpackModuleRule,
7-
} = require('customize-cra');
8-
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
7+
} = require("customize-cra");
8+
const ReactRefreshPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
9+
const { ESBuildPlugin } = require("esbuild-loader");
910

1011
module.exports = (config, env) => {
11-
const prod = config.mode === 'production';
12+
const prod = config.mode === "production";
1213
const babelLoader = getBabelLoader(config);
1314

1415
return override(
16+
addWebpackModuleRule({
17+
test: /.tsx?$/,
18+
use: [
19+
{
20+
loader: "esbuild-loader",
21+
options: { loader: "tsx", target: "es2015" },
22+
},
23+
],
24+
}),
25+
26+
addWebpackModuleRule({
27+
test: /.jsx?$/,
28+
use: [
29+
{
30+
loader: "esbuild-loader",
31+
options: { loader: "jsx", target: "es2015" },
32+
},
33+
],
34+
}),
1535
// You can choose to just use worker-loader! instead if you want
1636
addWebpackModuleRule({
1737
test: /\.worker\.[jt]sx?$/,
1838
use: [
19-
{ loader: 'worker-loader' },
39+
{ loader: "worker-loader" },
2040
{ loader: babelLoader.loader, options: babelLoader.options },
2141
],
2242
}),
23-
24-
!prod && addBabelPlugin('react-refresh/babel'),
43+
addWebpackPlugin(new ESBuildPlugin()),
44+
!prod && addBabelPlugin("react-refresh/babel"),
2545
!prod && addWebpackPlugin(new ReactRefreshPlugin())
2646
)(config, env);
2747
};

packages/hedgehog-lab/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"clsx": "^1.1.1",
1313
"codemirror": "^5.58.3",
1414
"comlink": "^4.3.0",
15+
"esbuild-loader": "^2.9.1",
1516
"ky": "^0.23.0",
1617
"monaco-editor": "^0.20.0",
1718
"plotly.js": "^1.54.6",

0 commit comments

Comments
 (0)