chore(docs): improve build performance and fix OOM crashes (#37588)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2026-02-05 16:12:46 -05:00
committed by GitHub
parent 47db185e3b
commit ef4f7afa90
9 changed files with 471 additions and 368 deletions

View File

@@ -67,8 +67,8 @@ export default function webpackExtendPlugin(): Plugin<void> {
use: 'js-yaml-loader',
});
// Add babel-loader rule for superset-frontend files
// This ensures Emotion CSS-in-JS is processed correctly for SSG
// Add swc-loader rule for superset-frontend files
// SWC is a Rust-based transpiler that's significantly faster than babel
const supersetFrontendPath = path.resolve(
__dirname,
'../../superset-frontend',
@@ -76,26 +76,37 @@ export default function webpackExtendPlugin(): Plugin<void> {
config.module?.rules?.push({
test: /\.(tsx?|jsx?)$/,
include: supersetFrontendPath,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
loader: 'swc-loader',
options: {
presets: [
[
'@babel/preset-react',
{
// Ignore superset-frontend/.swcrc which references plugins not
// installed in the docs workspace (e.g. @swc/plugin-emotion)
swcrc: false,
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'automatic',
importSource: '@emotion/react',
},
],
'@babel/preset-typescript',
],
plugins: ['@emotion/babel-plugin'],
},
},
},
},
});
return {
devtool: isDev ? 'eval-source-map' : config.devtool,
devtool: isDev ? false : config.devtool,
cache: {
type: 'filesystem',
buildDependencies: {
config: [__filename],
},
},
...(isDev && {
optimization: {
...config.optimization,
@@ -208,8 +219,6 @@ export default function webpackExtendPlugin(): Plugin<void> {
),
},
},
// We're removing the ts-loader rule that was processing superset-frontend files
// This will prevent TypeScript errors from files outside the docs directory
};
},
};