Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sourcemaps #39301

Merged
merged 1 commit into from
Feb 16, 2025
Merged

fix: sourcemaps #39301

merged 1 commit into from
Feb 16, 2025

Conversation

KelvinOm
Copy link
Collaborator

@KelvinOm KelvinOm commented Feb 16, 2025

Description

  • Returned the logic for generating the source maps. Source maps are created for flags REACT_APP_ENVIRONMENT=PRODUCTION and REACT_APP_ENVIRONMENT=DEVELOPMENT as before.
  • Removed no longer used flag DISABLE_ESLINT_PLUGIN
  • Removed no longer used cra-bundle-analyzer package and related script.

EE PR — https://github.com/appsmithorg/appsmith-ee/pull/6227

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13353994445
Commit: 88551e5
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ServerSide/Datasources/Snowflake_Basic_Spec.ts
List of identified flaky tests.
Sun, 16 Feb 2025 12:54:58 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Chores
    • Updated the build process to consistently enforce quality checks.
    • Enhanced debugging support by refining source mapping for both production and development environments.
    • Removed an outdated analysis task to streamline the startup routine.

Copy link
Contributor

coderabbitai bot commented Feb 16, 2025

Walkthrough

The changes adjust the build and configuration process across several components. The build script no longer disables ESLint, ensuring linting runs during the build. The webpack configuration now uses the REACT_APP_ENVIRONMENT variable to set source map options more granularly, refining loader configurations and exclusion patterns. Additionally, the analyze script has been removed from the package.json, and the start script no longer disables the ESLint plugin.

Changes

File Change Summary
app/client/build.sh Removed the export DISABLE_ESLINT_PLUGIN=true line, so ESLint remains active during building.
app/client/config/webpack.config.js Updated devtool and source map settings based on REACT_APP_ENVIRONMENT; refined loader configurations and exclusion patterns; simplified warning handling.
app/client/package.json Removed the analyze script; updated the start script by removing the DISABLE_ESLINT_PLUGIN=true environment variable.

Suggested labels

skip-changelog

Suggested reviewers

  • sharat87
  • dvj1988
  • pratapaprasanna

Poem

A tweak in our build, a shift in our code,
ESLint is back on the active road.
Webpack maps with a cleaner sight,
Scripts refined, shining bright.
Cheers to progress and code in flight! 🎉


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0f22d8 and 88551e5.

⛔ Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • app/client/build.sh (0 hunks)
  • app/client/config/webpack.config.js (9 hunks)
  • app/client/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • app/client/build.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/config/webpack.config.js
  • app/client/package.json
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Bug Something isn't working label Feb 16, 2025
@KelvinOm KelvinOm added the ok-to-test Required label for CI label Feb 16, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/client/config/webpack.config.js (1)

157-159: Standardize source map configuration across loaders.

The source map generation is now consistently controlled by REACT_APP_ENVIRONMENT across all loaders, but the condition is repeated multiple times.

Consider extracting the repeated condition into a constant:

+const shouldGenerateSourceMap = 
+  process.env.REACT_APP_ENVIRONMENT === "PRODUCTION" ||
+  process.env.REACT_APP_ENVIRONMENT === "DEVELOPMENT";

-sourceMap:
-  process.env.REACT_APP_ENVIRONMENT === "PRODUCTION" ||
-  process.env.REACT_APP_ENVIRONMENT === "DEVELOPMENT",
+sourceMap: shouldGenerateSourceMap,

Also applies to: 168-170, 177-179, 194-197, 514-519, 534-536, 554-556

app/client/package.json (1)

1-424:

❓ Verification inconclusive

Verify impact of removing bundle analysis capability.

The removal of the analyze script might affect the team's ability to monitor and optimize bundle sizes.

Consider alternatives for bundle analysis:

  1. Use webpack-bundle-analyzer as a development dependency
  2. Configure source-map-explorer
  3. Use the built-in webpack stats

🏁 Script executed:

#!/bin/bash
# Check if there are any existing bundle analysis tools
rg -l "webpack-bundle-analyzer|source-map-explorer" package.json

Length of output: 119


IMPORTANT: Verify Bundle Analysis Impact

The removal of the analyze script may affect our ability to monitor and optimize bundle sizes. Note that our initial search for bundle analysis tools yielded an error because the command targeted the wrong file path (root package.json instead of app/client/package.json).

  • Action: Manually verify whether any bundle analysis references (e.g., webpack-bundle-analyzer or source-map-explorer) remain in app/client/package.json or elsewhere in the repository.
  • Suggestion: If bundle analysis is still required, consider:
    • Adding webpack-bundle-analyzer as a development dependency.
    • Configuring source-map-explorer.
    • Utilizing the built-in webpack stats.

Please ensure that the intended alternatives are adequately set up to maintain our bundle size monitoring and optimization capabilities.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 007f598 and b0f22d8.

⛔ Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • app/client/build.sh (0 hunks)
  • app/client/config/webpack.config.js (10 hunks)
  • app/client/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • app/client/build.sh
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (4)
app/client/config/webpack.config.js (3)

400-400: Improved source map loader exclusion pattern.

The exclusion pattern now correctly excludes both @babel/runtime and node_modules, which will improve build performance.


637-647: Simplified FaroSourceMapUploaderPlugin condition.

The plugin is now only enabled in the PRODUCTION environment, which aligns with best practices for source map uploading.


488-488:

❓ Verification inconclusive

Verify babel-loader exclusion impact.

The addition of exclude: /node_modules/ to babel-loader might affect transpilation of node_modules that need to be processed.


🏁 Script executed:

#!/bin/bash
# Search for any babel configuration files that might override this setting
fd -t f -e babelrc -e babel.config.js -e babel.config.json

# Search for any packages in node_modules that might need transpilation
rg -l "browsers|targets" node_modules/*/package.json

Length of output: 185


Review Verification Outcome: Babel-loader Exclusion Impact

The automated checks did not reveal any babel configuration files overriding the webpack setting, nor did they identify node_modules packages requiring transpilation. However, since the node_modules directory isn’t populated in the repository (and the grep for package.json in node_modules returned an error), please manually verify that no third‐party modules need Babel processing. If some modules require transpilation, consider adjusting or explicitly overriding the default exclusion.

Impacted snippet in app/client/config/webpack.config.js (line 488):

                exclude: /node_modules/,
app/client/package.json (1)

18-18: ESLint is now enabled during development.

Removing DISABLE_ESLINT_PLUGIN=true will help catch issues earlier in the development cycle.

@KelvinOm
Copy link
Collaborator Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13354778486.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39301.
recreate: .

@appsmithorg appsmithorg deleted a comment from github-actions bot Feb 16, 2025
@appsmithorg appsmithorg deleted a comment from github-actions bot Feb 16, 2025
@appsmithorg appsmithorg deleted a comment from github-actions bot Feb 16, 2025
@appsmithorg appsmithorg deleted a comment from github-actions bot Feb 16, 2025
Copy link

Deploy-Preview-URL: https://ce-39301.dp.appsmith.com

@@ -16,8 +16,6 @@ fi
# build cra app
export REACT_APP_SENTRY_RELEASE=$GIT_SHA
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
# Disable CRA built-in ESLint checks since we have our own config and a separate step for this
export DISABLE_ESLINT_PLUGIN=true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is no longer used.

@@ -586,13 +601,6 @@ module.exports = function (webpackEnv) {
].filter(Boolean),
},
ignoreWarnings: [
function ignoreSourcemapsloaderWarnings(warning) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer ignore the warnings of the source maps, we just excluded the node modules from the generation.
https://github.com/appsmithorg/appsmith/pull/39301/files#diff-2826783e90c72e4335b396bb94e6783ea1a2f9c26af76de107dd9f5fe6d5191aR399

@@ -15,8 +15,7 @@
"!packages/**/build"
],
"scripts": {
"analyze": "yarn cra-bundle-analyzer",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is no longer relevant

devtool:
(process.env.REACT_APP_ENVIRONMENT === "PRODUCTION" && "source-map") ||
(process.env.REACT_APP_ENVIRONMENT === "DEVELOPMENT" &&
"cheap-module-source-map"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev mode only works fine with cheap-module-source-map. Other types do not work correctly due to an error in zone.js and we see blank page. The same type of source maps was used earlier in react-scripts.
It will be necessary to figure out how to enable recommended type eval-source-map. With eval-source-map, the app is rebuilt 2 times faster(4s instead 8s).

Снимок экрана 2025-02-15 в 23 09 51
Appsmith Applications

@KelvinOm KelvinOm enabled auto-merge (squash) February 16, 2025 17:05
@KelvinOm KelvinOm disabled auto-merge February 16, 2025 17:05
@KelvinOm KelvinOm merged commit 19acf7c into release Feb 16, 2025
87 of 89 checks passed
@KelvinOm KelvinOm deleted the fix/sourcemaps branch February 16, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants