korbit-ai[bot] commented on code in PR #35946: URL: https://github.com/apache/superset/pull/35946#discussion_r2485327089
########## superset/config.py: ########## @@ -837,6 +837,9 @@ class D3TimeFormat(TypedDict, total=False): } THUMBNAIL_ERROR_CACHE_TTL = int(timedelta(days=1).total_seconds()) +# Cache warmup user +SUPERSET_CACHE_WARMUP_USER = "admin" Review Comment: ### Hardcoded Admin Username for Cache Warmup <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The cache warmup user is hardcoded as 'admin' rather than being configurable through environment variables like other sensitive configurations. ###### Why this matters Hardcoding the admin username reduces flexibility and security by not allowing different deployments to use custom admin usernames. This makes the application less configurable and potentially less secure. ###### Suggested change ∙ *Feature Preview* Make the cache warmup user configurable via environment variables: ```python SUPERSET_CACHE_WARMUP_USER = os.environ.get('SUPERSET_CACHE_WARMUP_USER', 'admin') ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a42ca8e0-c7ea-4a24-b1ed-762a6118757b/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a42ca8e0-c7ea-4a24-b1ed-762a6118757b?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a42ca8e0-c7ea-4a24-b1ed-762a6118757b?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a42ca8e0-c7ea-4a24-b1ed-762a6118757b?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a42ca8e0-c7ea-4a24-b1ed-762a6118757b) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:2a449033-fec3-448f-814d-b371f6467ab0 --> [](2a449033-fec3-448f-814d-b371f6467ab0) ########## superset/utils/webdriver.py: ########## @@ -243,7 +246,30 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n class WebDriverSelenium(WebDriverProxy): - def create(self) -> WebDriver: + def __init__( + self, + driver_type: str, + window: WindowSize | None = None, + user: User | None = None, + ): + super().__init__(driver_type, window) + self._user = user + self._driver = None Review Comment: ### Driver instance not reused across screenshot calls <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? WebDriverSelenium creates a new driver instance for each screenshot request through the lazy-loaded driver property, but doesn't reuse the driver across multiple screenshot calls. ###### Why this matters This leads to significant performance overhead as each screenshot operation will create, configure, and destroy a WebDriver instance, including browser startup time, authentication, and window sizing. For applications taking multiple screenshots, this creates unnecessary resource consumption and latency. ###### Suggested change ∙ *Feature Preview* The current implementation already supports driver reuse through the lazy-loaded `driver` property. However, consider implementing a driver pool or connection pooling pattern for concurrent screenshot operations to further optimize performance when multiple screenshots are needed simultaneously. ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/67c522ac-c08c-44ad-8d69-6c97fdfc60bf/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/67c522ac-c08c-44ad-8d69-6c97fdfc60bf?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/67c522ac-c08c-44ad-8d69-6c97fdfc60bf?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/67c522ac-c08c-44ad-8d69-6c97fdfc60bf?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/67c522ac-c08c-44ad-8d69-6c97fdfc60bf) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:263614db-a981-465a-8c23-062aa0b415fa --> [](263614db-a981-465a-8c23-062aa0b415fa) ########## superset/utils/webdriver.py: ########## @@ -381,10 +413,14 @@ def find_unexpected_errors(driver: WebDriver) -> list[str]: return error_messages - def get_screenshot(self, url: str, element_name: str, user: User) -> bytes | None: # noqa: C901 - driver = self.auth(user) - driver.set_window_size(*self._window) - driver.get(url) + def get_screenshot( # noqa: C901 + self, url: str, element_name: str, user: User | None = None + ) -> bytes | None: + if user and not self._user: + self._user = user + if self._driver: + self._auth(user) Review Comment: ### Redundant authentication on every screenshot call <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? Authentication is performed on every screenshot call when a user is provided, even if the driver is already authenticated for the same user. ###### Why this matters This causes unnecessary authentication overhead for subsequent screenshot requests with the same user, adding latency and potentially hitting authentication rate limits or causing session conflicts. ###### Suggested change ∙ *Feature Preview* Add user comparison logic to only re-authenticate when the user actually changes: ```python if user and user != self._user: self._user = user if self._driver: self._auth(user) ``` This requires implementing `__eq__` method on the User class or comparing user IDs. ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5e307934-8dd5-437c-8df6-a96f1ffe597e/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5e307934-8dd5-437c-8df6-a96f1ffe597e?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5e307934-8dd5-437c-8df6-a96f1ffe597e?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5e307934-8dd5-437c-8df6-a96f1ffe597e?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5e307934-8dd5-437c-8df6-a96f1ffe597e) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:1429d983-09e8-4a86-9464-218d527cb0f4 --> [](1429d983-09e8-4a86-9464-218d527cb0f4) ########## superset/utils/webdriver.py: ########## @@ -381,10 +413,14 @@ def find_unexpected_errors(driver: WebDriver) -> list[str]: return error_messages - def get_screenshot(self, url: str, element_name: str, user: User) -> bytes | None: # noqa: C901 - driver = self.auth(user) - driver.set_window_size(*self._window) - driver.get(url) + def get_screenshot( # noqa: C901 + self, url: str, element_name: str, user: User | None = None + ) -> bytes | None: + if user and not self._user: + self._user = user + if self._driver: + self._auth(user) Review Comment: ### Incorrect user authentication logic in WebDriverSelenium <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The logic for handling user authentication in WebDriverSelenium.get_screenshot() is flawed. It only sets self._user and authenticates when user is provided AND self._user is None, but it doesn't handle the case where a different user is passed in subsequent calls. ###### Why this matters This will cause authentication failures when the same WebDriverSelenium instance is reused with different users, as the second user won't be authenticated if self._user was already set by the first user. ###### Suggested change ∙ *Feature Preview* The logic should compare the current user with the stored user and re-authenticate if they differ: ```python if user != self._user: self._user = user if self._driver and user: self._auth(user) ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5d53a48b-481e-4d6f-8c26-1b4315c26800/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5d53a48b-481e-4d6f-8c26-1b4315c26800?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5d53a48b-481e-4d6f-8c26-1b4315c26800?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5d53a48b-481e-4d6f-8c26-1b4315c26800?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5d53a48b-481e-4d6f-8c26-1b4315c26800) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:f221b242-3a0b-4832-ae7c-10a77cdc510d --> [](f221b242-3a0b-4832-ae7c-10a77cdc510d) ########## superset-frontend/webpack.config.js: ########## @@ -175,31 +198,60 @@ function addPreamble(entry) { return PREAMBLE.concat([path.join(APP_DIR, entry)]); } -const babelLoader = { - loader: 'babel-loader', +// SWC configuration for TypeScript/JavaScript transpilation +const swcLoader = { + loader: 'swc-loader', options: { - cacheDirectory: true, - // disable gzip compression for cache files - // faster when there are millions of small files - cacheCompression: false, - presets: [ - [ - '@babel/preset-react', - { + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + decorators: false, + dynamicImport: true, + }, + transform: { + react: { runtime: 'automatic', importSource: '@emotion/react', + development: isDevMode, + refresh: isDevMode, }, - ], - ], - plugins: [ - [ - '@emotion/babel-plugin', - { - autoLabel: 'dev-only', - labelFormat: '[local]', - }, - ], - ], + }, + 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', + }, + minify: mode === 'production', }, }; Review Comment: ### Duplicated SWC loader configuration <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The SWC loader configuration is duplicated between TypeScript and JavaScript rules, creating redundant code that increases maintenance overhead. ###### Why this matters This duplication means any configuration changes must be made in multiple places, increasing the risk of inconsistencies and making the webpack config harder to maintain and debug. ###### Suggested change ∙ *Feature Preview* Extract the common SWC configuration into a function that accepts syntax-specific parameters: ```javascript function createSwcLoader(syntax = 'typescript') { return { loader: 'swc-loader', options: { jsc: { parser: { syntax, tsx: syntax === 'typescript', jsx: syntax === 'ecmascript', decorators: false, dynamicImport: true, }, // ... rest of common config }, module: { type: 'es6' }, minify: mode === 'production', }, }; } ``` Then use `createSwcLoader('typescript')` and `createSwcLoader('ecmascript')` in the respective rules. ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/51d5e5bf-365b-438e-9554-9785d41e94c6/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/51d5e5bf-365b-438e-9554-9785d41e94c6?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/51d5e5bf-365b-438e-9554-9785d41e94c6?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/51d5e5bf-365b-438e-9554-9785d41e94c6?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/51d5e5bf-365b-438e-9554-9785d41e94c6) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:d5704381-3dd0-46c0-8555-dc7539139673 --> [](d5704381-3dd0-46c0-8555-dc7539139673) ########## docs/docs/configuration/cache.mdx: ########## @@ -80,6 +80,30 @@ instead requires a cachelib object. See [Async Queries via Celery](/docs/configuration/async-queries-celery) for details. +## Celery beat + +Superset has a Celery task that will periodically warm up the cache based on different strategies. +To use it, add the following to the `CELERYBEAT_SCHEDULE` section in `config.py`: + +```python +SUPERSET_CACHE_WARMUP_USER = "user_with_permission_to_dashboards" Review Comment: ### Invalid placeholder username in cache warmup config <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The configuration uses a placeholder string instead of an actual username, which will cause the cache warmup task to fail when executed. ###### Why this matters When Celery attempts to run the cache warmup task, it will try to authenticate as a user named literally 'user_with_permission_to_dashboards', which is unlikely to exist in any real Superset installation, causing authentication failures and preventing cache warmup from functioning. ###### Suggested change ∙ *Feature Preview* Replace the placeholder with a clear instruction for users to substitute their actual username: ```python SUPERSET_CACHE_WARMUP_USER = "admin" # Replace with actual username that has dashboard permissions ``` Or add a comment explaining this is a placeholder: ```python SUPERSET_CACHE_WARMUP_USER = "user_with_permission_to_dashboards" # Replace with actual username ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ad92f70d-2b7a-42f3-8a9a-fbed7e9628cd/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ad92f70d-2b7a-42f3-8a9a-fbed7e9628cd?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ad92f70d-2b7a-42f3-8a9a-fbed7e9628cd?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ad92f70d-2b7a-42f3-8a9a-fbed7e9628cd?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ad92f70d-2b7a-42f3-8a9a-fbed7e9628cd) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:acfc41e6-2931-4694-ab85-641a7a183cb6 --> [](acfc41e6-2931-4694-ab85-641a7a183cb6) ########## superset/utils/webdriver.py: ########## @@ -243,7 +246,30 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n class WebDriverSelenium(WebDriverProxy): - def create(self) -> WebDriver: + def __init__( + self, + driver_type: str, + window: WindowSize | None = None, + user: User | None = None, + ): + super().__init__(driver_type, window) + self._user = user + self._driver = None + + def __del__(self) -> None: + self._destroy() + + @property + def driver(self) -> WebDriver: + if not self._driver: + self._driver = self._create() + assert self._driver # for mypy + self._driver.set_window_size(*self._window) + if self._user: + self._auth(self._user) + return self._driver Review Comment: ### Driver property doesn't handle user changes after creation <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The driver property creates and authenticates the driver only on first access, but doesn't handle cases where the user changes after the driver is already created. ###### Why this matters If a user is set after the driver is created (via get_screenshot), the driver won't be authenticated with that user, leading to authorization failures when accessing protected resources. ###### Suggested change ∙ *Feature Preview* The authentication logic should be moved to get_screenshot method or the property should check for user changes: ```python @property def driver(self) -> WebDriver: if not self._driver: self._driver = self._create() assert self._driver # for mypy self._driver.set_window_size(*self._window) return self._driver ``` And handle authentication separately in get_screenshot method. ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3a19e518-557d-4363-b487-1824790bd1d1/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3a19e518-557d-4363-b487-1824790bd1d1?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3a19e518-557d-4363-b487-1824790bd1d1?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3a19e518-557d-4363-b487-1824790bd1d1?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3a19e518-557d-4363-b487-1824790bd1d1) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:8dfe6754-0f59-4251-8574-68d023d3079b --> [](8dfe6754-0f59-4251-8574-68d023d3079b) ########## superset/config.py: ########## @@ -837,6 +837,9 @@ class D3TimeFormat(TypedDict, total=False): } THUMBNAIL_ERROR_CACHE_TTL = int(timedelta(days=1).total_seconds()) +# Cache warmup user +SUPERSET_CACHE_WARMUP_USER = "admin" Review Comment: ### Hardcoded admin user may not exist <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The cache warmup user is hardcoded to "admin" which may not exist in all Superset installations or may have different naming conventions. ###### Why this matters If the "admin" user doesn't exist in a particular Superset installation, cache warmup operations will fail. Different organizations may use different naming conventions for administrative users (e.g., "administrator", "root", "superuser"). ###### Suggested change ∙ *Feature Preview* Make the configuration more flexible by either: 1. Adding validation to check if the user exists 2. Providing a fallback mechanism 3. Making it configurable via environment variable Example: ```python SUPERSET_CACHE_WARMUP_USER = os.environ.get("SUPERSET_CACHE_WARMUP_USER", "admin") ``` Or add a comment explaining the requirement: ```python # Cache warmup user - ensure this user exists in your Superset installation SUPERSET_CACHE_WARMUP_USER = "admin" ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b9b0b419-2302-49fa-8b99-2469ef040ba5/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b9b0b419-2302-49fa-8b99-2469ef040ba5?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b9b0b419-2302-49fa-8b99-2469ef040ba5?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b9b0b419-2302-49fa-8b99-2469ef040ba5?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b9b0b419-2302-49fa-8b99-2469ef040ba5) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:5186c7fd-d6a2-40e8-b383-a16621d39574 --> [](5186c7fd-d6a2-40e8-b383-a16621d39574) ########## superset/config.py: ########## @@ -837,6 +837,9 @@ class D3TimeFormat(TypedDict, total=False): } THUMBNAIL_ERROR_CACHE_TTL = int(timedelta(days=1).total_seconds()) +# Cache warmup user +SUPERSET_CACHE_WARMUP_USER = "admin" Review Comment: ### Hardcoded cache warmup user limits cache effectiveness <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? Hardcoded cache warmup user creates a potential performance bottleneck by forcing all cache warmup operations to use a single user account. ###### Why this matters This could lead to permission-based cache misses when different users access the same data, as cached results may not be accessible to users with different permissions than the hardcoded 'admin' user. Additionally, it prevents leveraging user-specific optimizations and could create contention around a single user's session/permissions. ###### Suggested change ∙ *Feature Preview* Make the cache warmup user configurable through environment variables or allow multiple users for cache warmup operations. Consider using `os.environ.get("SUPERSET_CACHE_WARMUP_USER", "admin")` to allow runtime configuration, or integrate with the existing `CACHE_WARMUP_EXECUTORS` pattern that already supports multiple execution strategies. ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a88644cf-3187-45fe-9383-c05a1bf238cb/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a88644cf-3187-45fe-9383-c05a1bf238cb?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a88644cf-3187-45fe-9383-c05a1bf238cb?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a88644cf-3187-45fe-9383-c05a1bf238cb?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a88644cf-3187-45fe-9383-c05a1bf238cb) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:c2843669-8e06-42e7-9376-ca97ff896eca --> [](c2843669-8e06-42e7-9376-ca97ff896eca) ########## superset-frontend/webpack.config.js: ########## @@ -175,31 +198,60 @@ function addPreamble(entry) { return PREAMBLE.concat([path.join(APP_DIR, entry)]); } -const babelLoader = { - loader: 'babel-loader', +// SWC configuration for TypeScript/JavaScript transpilation +const swcLoader = { + loader: 'swc-loader', options: { - cacheDirectory: true, - // disable gzip compression for cache files - // faster when there are millions of small files - cacheCompression: false, - presets: [ - [ - '@babel/preset-react', - { + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + decorators: false, + dynamicImport: true, + }, + transform: { + react: { runtime: 'automatic', importSource: '@emotion/react', + development: isDevMode, + refresh: isDevMode, }, - ], - ], - plugins: [ - [ - '@emotion/babel-plugin', - { - autoLabel: 'dev-only', - labelFormat: '[local]', - }, - ], - ], + }, + 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', + }, + minify: mode === 'production', Review Comment: ### Redundant minification in SWC loader <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The SWC loader is configured to minify code based on mode, but this conflicts with webpack's optimization.minimize setting and the dedicated TerserPlugin minimizer. ###### Why this matters This creates redundant minification that can lead to slower builds, potential conflicts between minifiers, and inconsistent output. The TerserPlugin should handle all minification in production. ###### Suggested change ∙ *Feature Preview* Remove the minify option from SWC loader configuration since minification is handled by TerserPlugin: ```javascript const swcLoader = { loader: 'swc-loader', options: { jsc: { // ... other options }, module: { type: 'es6', }, // Remove this line: minify: mode === 'production', }, }; ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6a17fc51-50c8-4fb6-90de-8fb1b1ada8fc/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6a17fc51-50c8-4fb6-90de-8fb1b1ada8fc?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6a17fc51-50c8-4fb6-90de-8fb1b1ada8fc?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6a17fc51-50c8-4fb6-90de-8fb1b1ada8fc?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6a17fc51-50c8-4fb6-90de-8fb1b1ada8fc) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:bbc1c14e-0243-47e9-b935-5b1f1e2e8001 --> [](bbc1c14e-0243-47e9-b935-5b1f1e2e8001) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
