codeant-ai-for-open-source[bot] commented on code in PR #36433:
URL: https://github.com/apache/superset/pull/36433#discussion_r2771840116
##########
superset-frontend/webpack.config.js:
##########
@@ -316,18 +310,29 @@ function createSwcLoader(syntax = 'typescript', tsx =
true) {
const config = {
entry: {
preamble: PREAMBLE,
- theme: path.join(APP_DIR, '/src/theme.ts'),
+ // In dev mode, theme is included in preamble to avoid separate chunk HMR
issues
+ ...(isDevMode ? {} : { theme: path.join(APP_DIR, 'src/theme.ts') }),
menu: addPreamble('src/views/menu.tsx'),
- spa: addPreamble('/src/views/index.tsx'),
- embedded: addPreamble('/src/embedded/index.tsx'),
+ spa: addPreamble('src/views/index.tsx'),
+ embedded: addPreamble('src/embedded/index.tsx'),
Review Comment:
**Suggestion:** The new `spa` and `embedded` webpack entry points reference
`.tsx` files (`src/views/index.tsx` and `src/embedded/index.tsx`) that do not
exist in the current codebase, which will cause webpack to fail with a "module
not found" error at build/dev-server startup; they should instead point to the
existing `.jsx` entry files (or to the correct actual paths). [logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Dev server fails to start; HMR unusable.
- ❌ Local frontend development blocked for contributors.
- ⚠️ CI frontend build will fail on build step.
- ⚠️ Developers must patch config or create files to continue.
```
</details>
```suggestion
spa: addPreamble('src/views/index.jsx'),
embedded: addPreamble('src/embedded/index.jsx'),
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Start the dev server: run `npm run dev-server`. Webpack loads
configuration from
`superset-frontend/webpack.config.js` (file present in repo root).
2. Webpack evaluates the `entry` object at lines around 316-317 in
`superset-frontend/webpack.config.js` and attempts to resolve the entry files
`src/views/index.tsx` and `src/embedded/index.tsx`.
3. The resolver fails to find those files in the repository. (Verified via
code search:
Grep returned a match for the string `src/views/index.tsx` only inside
`superset-frontend/webpack.config.js` and found no matches for
`src/views/index.jsx`,
`src/embedded/index.tsx`, or `src/embedded/index.jsx` elsewhere in the
codebase.)
4. Expected outcome: webpack reports "Module not found: Error: Can't resolve
'./src/views/index.tsx' in .../superset-frontend" (build/dev-server startup
fails),
preventing the dev server from starting and blocking HMR and local
development.
Note: If the actual entry files are named differently (for example `.jsx`)
or live in
another path, the config must match their real filenames/locations. The Grep
results show
no `.tsx` or `.jsx` entry files in those paths in this repository snapshot,
so the
mismatch is real.
```
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/webpack.config.js
**Line:** 316:317
**Comment:**
*Logic Error: The new `spa` and `embedded` webpack entry points
reference `.tsx` files (`src/views/index.tsx` and `src/embedded/index.tsx`)
that do not exist in the current codebase, which will cause webpack to fail
with a "module not found" error at build/dev-server startup; they should
instead point to the existing `.jsx` entry files (or to the correct actual
paths).
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
```
</details>
--
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]