feat(build): Migrate webpack to SWC for ~70%+ faster builds (#35946)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2025-11-06 08:14:52 -08:00
committed by GitHub
parent 3765c31163
commit 0827ff7687
6 changed files with 702 additions and 115 deletions

View File

@@ -11,6 +11,7 @@
.nvmrc
.prettierrc
.rat-excludes
.swcrc
.*log
.*pyc
.*lock

View File

@@ -4,3 +4,4 @@ cypress/videos
src/temp
.temp_cache/
.tsbuildinfo
.swc/

64
superset-frontend/.swcrc Normal file
View File

@@ -0,0 +1,64 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false,
"dynamicImport": true
},
"transform": {
"react": {
"runtime": "automatic",
"importSource": "@emotion/react",
"throwIfNamespace": true
},
"optimizer": {
"globals": {
"vars": {
"process.env.NODE_ENV": "production"
}
}
}
},
"target": "es2015",
"loose": true,
"externalHelpers": false,
"preserveAllComments": false,
"experimental": {
"plugins": [
[
"@swc/plugin-emotion",
{
"sourceMap": true,
"autoLabel": "dev-only",
"labelFormat": "[local]"
}
],
[
"@swc/plugin-transform-imports",
{
"lodash": {
"transform": "lodash/{{member}}",
"preventFullImport": true,
"skipDefaultConversion": false
},
"lodash-es": {
"transform": "lodash-es/{{member}}",
"preventFullImport": true,
"skipDefaultConversion": false
}
}
]
]
}
},
"module": {
"type": "es6",
"strict": false,
"strictMode": false,
"lazy": false,
"noInterop": false
},
"minify": false
}

View File

@@ -7,7 +7,6 @@
"": {
"name": "superset",
"version": "0.0.0-dev",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
"packages/*",
@@ -173,6 +172,9 @@
"@storybook/react": "8.1.11",
"@storybook/react-webpack5": "8.1.11",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.14.0",
"@swc/plugin-emotion": "^12.0.0",
"@swc/plugin-transform-imports": "^10.0.0",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^12.1.5",
@@ -247,6 +249,7 @@
"jest-websocket-mock": "^2.5.0",
"jsdom": "^27.0.0",
"lerna": "^8.2.3",
"lightningcss": "^1.30.2",
"mini-css-extract-plugin": "^2.9.0",
"open-cli": "^8.0.0",
"oxlint": "^1.16.0",
@@ -262,6 +265,8 @@
"speed-measure-webpack-plugin": "^1.5.0",
"storybook": "8.1.11",
"style-loader": "^4.0.0",
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.14",
"thread-loader": "^4.0.4",
"ts-jest": "^29.4.5",
"ts-loader": "^9.5.1",
@@ -15352,6 +15357,242 @@
"url": "https://github.com/sponsors/gregberge"
}
},
"node_modules/@swc/core": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.14.0.tgz",
"integrity": "sha512-oExhY90bes5pDTVrei0xlMVosTxwd/NMafIpqsC4dMbRYZ5KB981l/CX8tMnGsagTplj/RcG9BeRYmV6/J5m3w==",
"devOptional": true,
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3",
"@swc/types": "^0.1.25"
},
"engines": {
"node": ">=10"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/swc"
},
"optionalDependencies": {
"@swc/core-darwin-arm64": "1.14.0",
"@swc/core-darwin-x64": "1.14.0",
"@swc/core-linux-arm-gnueabihf": "1.14.0",
"@swc/core-linux-arm64-gnu": "1.14.0",
"@swc/core-linux-arm64-musl": "1.14.0",
"@swc/core-linux-x64-gnu": "1.14.0",
"@swc/core-linux-x64-musl": "1.14.0",
"@swc/core-win32-arm64-msvc": "1.14.0",
"@swc/core-win32-ia32-msvc": "1.14.0",
"@swc/core-win32-x64-msvc": "1.14.0"
},
"peerDependencies": {
"@swc/helpers": ">=0.5.17"
},
"peerDependenciesMeta": {
"@swc/helpers": {
"optional": true
}
}
},
"node_modules/@swc/core-darwin-arm64": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.14.0.tgz",
"integrity": "sha512-uHPC8rlCt04nvYNczWzKVdgnRhxCa3ndKTBBbBpResOZsRmiwRAvByIGh599j+Oo6Z5eyTPrgY+XfJzVmXnN7Q==",
"cpu": [
"arm64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-darwin-x64": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.14.0.tgz",
"integrity": "sha512-2SHrlpl68vtePRknv9shvM9YKKg7B9T13tcTg9aFCwR318QTYo+FzsKGmQSv9ox/Ua0Q2/5y2BNjieffJoo4nA==",
"cpu": [
"x64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm-gnueabihf": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.14.0.tgz",
"integrity": "sha512-SMH8zn01dxt809svetnxpeg/jWdpi6dqHKO3Eb11u4OzU2PK7I5uKS6gf2hx5LlTbcJMFKULZiVwjlQLe8eqtg==",
"cpu": [
"arm"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm64-gnu": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.14.0.tgz",
"integrity": "sha512-q2JRu2D8LVqGeHkmpVCljVNltG0tB4o4eYg+dElFwCS8l2Mnt9qurMCxIeo9mgoqz0ax+k7jWtIRHktnVCbjvQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm64-musl": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.14.0.tgz",
"integrity": "sha512-uofpVoPCEUjYIv454ZEZ3sLgMD17nIwlz2z7bsn7rl301Kt/01umFA7MscUovFfAK2IRGck6XB+uulMu6aFhKQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-x64-gnu": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.14.0.tgz",
"integrity": "sha512-quTTx1Olm05fBfv66DEBuOsOgqdypnZ/1Bh3yGXWY7ANLFeeRpCDZpljD9BSjdsNdPOlwJmEUZXMHtGm3v1TZQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-x64-musl": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.14.0.tgz",
"integrity": "sha512-caaNAu+aIqT8seLtCf08i8C3/UC5ttQujUjejhMcuS1/LoCKtNiUs4VekJd2UGt+pyuuSrQ6dKl8CbCfWvWeXw==",
"cpu": [
"x64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-arm64-msvc": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.14.0.tgz",
"integrity": "sha512-EeW3jFlT3YNckJ6V/JnTfGcX7UHGyh6/AiCPopZ1HNaGiXVCKHPpVQZicmtyr/UpqxCXLrTgjHOvyMke7YN26A==",
"cpu": [
"arm64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-ia32-msvc": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.14.0.tgz",
"integrity": "sha512-dPai3KUIcihV5hfoO4QNQF5HAaw8+2bT7dvi8E5zLtecW2SfL3mUZipzampXq5FHll0RSCLzlrXnSx+dBRZIIQ==",
"cpu": [
"ia32"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-x64-msvc": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.14.0.tgz",
"integrity": "sha512-nm+JajGrTqUA6sEHdghDlHMNfH1WKSiuvljhdmBACW4ta4LC3gKurX2qZuiBARvPkephW9V/i5S8QPY1PzFEqg==",
"cpu": [
"x64"
],
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/counter": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
"devOptional": true,
"license": "Apache-2.0"
},
"node_modules/@swc/plugin-emotion": {
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/@swc/plugin-emotion/-/plugin-emotion-12.0.0.tgz",
"integrity": "sha512-I2GmyZBtikDWPz3MsgFf32w4Uy1ek6WWv+rRrKoJjFuseexqvpnu8XhRmekYUYjubnlhoBkDqzfZgMJYqfecPg==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3"
}
},
"node_modules/@swc/plugin-transform-imports": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@swc/plugin-transform-imports/-/plugin-transform-imports-10.0.0.tgz",
"integrity": "sha512-L20i7gidyCgN1pZwmZwn25WLMwjzM2r90vy0BUU4iOUz6a60HlAjYVACCGIR+hj5cNjUnxhnzTPawN5M92SFMQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3"
}
},
"node_modules/@swc/types": {
"version": "0.1.25",
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.25.tgz",
"integrity": "sha512-iAoY/qRhNH8a/hBvm3zKj9qQ4oc2+3w1unPJa2XvTK3XjeLXtzcCingVPw/9e5mn1+0yPqxcBGp9Jf0pkfMb1g==",
"devOptional": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3"
}
},
"node_modules/@szmarczak/http-timer": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz",
@@ -24477,6 +24718,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/detect-libc": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@@ -37820,6 +38071,267 @@
"set-cookie-parser": "^2.4.1"
}
},
"node_modules/lightningcss": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz",
"integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"detect-libc": "^2.0.3"
},
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"optionalDependencies": {
"lightningcss-android-arm64": "1.30.2",
"lightningcss-darwin-arm64": "1.30.2",
"lightningcss-darwin-x64": "1.30.2",
"lightningcss-freebsd-x64": "1.30.2",
"lightningcss-linux-arm-gnueabihf": "1.30.2",
"lightningcss-linux-arm64-gnu": "1.30.2",
"lightningcss-linux-arm64-musl": "1.30.2",
"lightningcss-linux-x64-gnu": "1.30.2",
"lightningcss-linux-x64-musl": "1.30.2",
"lightningcss-win32-arm64-msvc": "1.30.2",
"lightningcss-win32-x64-msvc": "1.30.2"
}
},
"node_modules/lightningcss-android-arm64": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.30.2.tgz",
"integrity": "sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-arm64": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz",
"integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-x64": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.2.tgz",
"integrity": "sha512-oBZgKchomuDYxr7ilwLcyms6BCyLn0z8J0+ZZmfpjwg9fRVZIR5/GMXd7r9RH94iDhld3UmSjBM6nXWM2TfZTQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-freebsd-x64": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.2.tgz",
"integrity": "sha512-c2bH6xTrf4BDpK8MoGG4Bd6zAMZDAXS569UxCAGcA7IKbHNMlhGQ89eRmvpIUGfKWNVdbhSbkQaWhEoMGmGslA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm-gnueabihf": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.2.tgz",
"integrity": "sha512-eVdpxh4wYcm0PofJIZVuYuLiqBIakQ9uFZmipf6LF/HRj5Bgm0eb3qL/mr1smyXIS1twwOxNWndd8z0E374hiA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-gnu": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.2.tgz",
"integrity": "sha512-UK65WJAbwIJbiBFXpxrbTNArtfuznvxAJw4Q2ZGlU8kPeDIWEX1dg3rn2veBVUylA2Ezg89ktszWbaQnxD/e3A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-musl": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.2.tgz",
"integrity": "sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-gnu": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.2.tgz",
"integrity": "sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-musl": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.2.tgz",
"integrity": "sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-arm64-msvc": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.2.tgz",
"integrity": "sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-x64-msvc": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.2.tgz",
"integrity": "sha512-5g1yc73p+iAkid5phb4oVFMB45417DkRevRbt/El/gKXJk4jid+vPFF/AXbxn05Aky8PapwzZrdJShv5C0avjw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lilconfig": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
@@ -54417,6 +54929,20 @@
"node": ">= 10"
}
},
"node_modules/swc-loader": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/swc-loader/-/swc-loader-0.2.6.tgz",
"integrity": "sha512-9Zi9UP2YmDpgmQVbyOPJClY0dwf58JDyDMQ7uRc4krmc72twNI2fvlBWHLqVekBpPc7h5NJkGVT1zNDxFrqhvg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@swc/counter": "^0.1.3"
},
"peerDependencies": {
"@swc/core": "^1.2.147",
"webpack": ">=2"
}
},
"node_modules/symbol-observable": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
@@ -54714,9 +55240,9 @@
}
},
"node_modules/terser-webpack-plugin": {
"version": "5.3.11",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.11.tgz",
"integrity": "sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==",
"version": "5.3.14",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@@ -251,6 +251,9 @@
"@storybook/react": "8.1.11",
"@storybook/react-webpack5": "8.1.11",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.14.0",
"@swc/plugin-emotion": "^12.0.0",
"@swc/plugin-transform-imports": "^10.0.0",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^12.1.5",
@@ -325,6 +328,7 @@
"jest-websocket-mock": "^2.5.0",
"jsdom": "^27.0.0",
"lerna": "^8.2.3",
"lightningcss": "^1.30.2",
"mini-css-extract-plugin": "^2.9.0",
"open-cli": "^8.0.0",
"oxlint": "^1.16.0",
@@ -340,6 +344,8 @@
"speed-measure-webpack-plugin": "^1.5.0",
"storybook": "8.1.11",
"style-loader": "^4.0.0",
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.14",
"thread-loader": "^4.0.4",
"ts-jest": "^29.4.5",
"ts-loader": "^9.5.1",

View File

@@ -27,6 +27,8 @@ const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const LightningCSS = require('lightningcss');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const {
WebpackManifestPlugin,
@@ -189,62 +191,23 @@ if (!isDevMode) {
);
}
// Type checking for both dev and production
// In dev mode, this provides real-time type checking and builds .d.ts files for plugins
// Can be disabled with DISABLE_TYPE_CHECK=true npm run dev
if (isDevMode) {
if (process.env.DISABLE_TYPE_CHECK) {
console.log('⚡ Type checking disabled (DISABLE_TYPE_CHECK=true)');
} else {
console.log(
'✅ Type checking enabled (disable with DISABLE_TYPE_CHECK=true npm run dev)',
);
// Optimized configuration for development - much faster type checking
plugins.push(
new ForkTsCheckerWebpackPlugin({
typescript: {
memoryLimit: TYPESCRIPT_MEMORY_LIMIT,
build: true, // Generate .d.ts files
mode: 'write-references', // Handle project references properly
// Use main tsconfig but with safe performance optimizations
configOverwrite: {
compilerOptions: {
// Only safe optimizations that won't cause errors
skipLibCheck: true, // Skip checking .d.ts files - safe and huge perf boost
incremental: true, // Enable incremental compilation
},
},
},
// Logger configuration
logger: 'webpack-infrastructure',
async: true, // Non-blocking type checking
// Only check files that webpack is actually processing
// This dramatically reduces the scope of type checking
issue: {
scope: 'webpack', // Only check files in webpack's module graph, not entire project
include: [
{ file: 'src/**/*.{ts,tsx}' },
{ file: 'packages/*/src/**/*.{ts,tsx}' },
{ file: 'plugins/*/src/**/*.{ts,tsx}' },
],
exclude: [{ file: '**/node_modules/**' }],
},
}),
);
}
} else {
// Production mode - full type checking
// TypeScript type checking configuration
// SWC handles transpilation, but we still need ForkTsCheckerWebpackPlugin
// to generate .d.ts files for the plugin packages
if (!isDevMode) {
plugins.push(
new ForkTsCheckerWebpackPlugin({
async: false,
typescript: {
memoryLimit: TYPESCRIPT_MEMORY_LIMIT,
build: true,
mode: 'write-references',
},
// Logger configuration
logger: 'webpack-infrastructure',
issue: {
exclude: [{ file: '**/node_modules/**' }],
memoryLimit: 4096,
build: true, // CRITICAL: Generate .d.ts files for plugins
mode: 'write-references', // Handle project references
configOverwrite: {
compilerOptions: {
skipLibCheck: true,
incremental: true,
},
},
},
}),
);
@@ -265,33 +228,64 @@ function addPreamble(entry) {
return PREAMBLE.concat([path.join(APP_DIR, entry)]);
}
const babelLoader = {
loader: 'babel-loader',
options: {
cacheDirectory: true,
// disable gzip compression for cache files
// faster when there are millions of small files
cacheCompression: false,
presets: [
[
'@babel/preset-react',
{
runtime: 'automatic',
importSource: '@emotion/react',
// SWC configuration for TypeScript/JavaScript transpilation
function createSwcLoader(syntax = 'typescript', tsx = true) {
return {
loader: 'swc-loader',
options: {
jsc: {
parser: {
syntax,
tsx: syntax === 'typescript' ? tsx : undefined,
jsx: syntax === 'ecmascript',
decorators: false,
dynamicImport: true,
},
],
],
plugins: [
[
'@emotion/babel-plugin',
{
autoLabel: 'dev-only',
labelFormat: '[local]',
transform: {
react: {
runtime: 'automatic',
importSource: '@emotion/react',
development: isDevMode,
refresh: isDevMode,
},
},
],
],
},
};
target: 'es2015',
loose: true,
externalHelpers: false,
experimental: {
plugins: [
[
'@swc/plugin-emotion',
{
sourceMap: isDevMode,
autoLabel: isDevMode ? 'dev-only' : 'never',
labelFormat: '[local]',
},
],
[
'@swc/plugin-transform-imports',
{
lodash: {
transform: 'lodash/{{member}}',
preventFullImport: true,
skipDefaultConversion: false,
},
'lodash-es': {
transform: 'lodash-es/{{member}}',
preventFullImport: true,
skipDefaultConversion: false,
},
},
],
],
},
},
module: {
type: 'es6',
},
},
};
}
const config = {
entry: {
@@ -386,7 +380,31 @@ const config = {
},
},
usedExports: 'global',
minimizer: [new CssMinimizerPlugin(), '...'],
minimizer: [
new CssMinimizerPlugin({
minify: CssMinimizerPlugin.lightningCssMinify,
minimizerOptions: {
targets: LightningCSS.browserslistToTargets([
'last 3 chrome versions',
'last 3 firefox versions',
'last 3 safari versions',
'last 3 edge versions',
]),
},
}),
new TerserPlugin({
minify: TerserPlugin.swcMinify,
terserOptions: {
compress: {
drop_console: false,
},
mangle: true,
format: {
comments: false,
},
},
}),
],
},
resolve: {
// resolve modules from `/superset_frontend/node_modules` and `/superset_frontend`
@@ -444,29 +462,8 @@ const config = {
},
{
test: /\.tsx?$/,
exclude: [/\.test.tsx?$/],
use: [
'thread-loader',
babelLoader,
{
loader: 'ts-loader',
options: {
// transpile only in happyPack mode
// type checking is done via fork-ts-checker-webpack-plugin
happyPackMode: true,
transpileOnly: true,
// must override compiler options here, even though we have set
// the same options in `tsconfig.json`, because they may still
// be overridden by `tsconfig.json` in node_modules subdirectories.
compilerOptions: {
esModuleInterop: false,
importHelpers: false,
module: 'esnext',
target: 'esnext',
},
},
},
],
exclude: [/\.test.tsx?$/, /node_modules/],
use: ['thread-loader', createSwcLoader('typescript', true)],
},
{
test: /\.jsx?$/,
@@ -479,20 +476,12 @@ const config = {
), // redundant but required for windows
/@encodable/,
],
use: [babelLoader],
use: [createSwcLoader('ecmascript')],
},
{
test: /ace-builds.*\/worker-.*$/,
type: 'asset/resource',
},
// react-hot-loader use "ProxyFacade", which is a wrapper for react Component
// see https://github.com/gaearon/react-hot-loader/issues/1311
// TODO: refactor recurseReactClone
{
test: /\.js$/,
include: /node_modules\/react-dom/,
use: ['react-hot-loader/webpack'],
},
{
test: /\.css$/,
include: [APP_DIR, /superset-ui.+\/src/],