chore: disable sourcemaps for non-prod builds and cleanup craco configs#38706
chore: disable sourcemaps for non-prod builds and cleanup craco configs#38706
Conversation
WalkthroughThe pull request introduces configuration modifications across several client-side build configuration files. The changes primarily focus on optimizing build and development server settings, including adjusting memory allocation in the build script, updating Webpack compression settings, and refining WebSocket and caching configurations. These modifications streamline the build and development processes for the client application. Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (4)
Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/client/craco.dev.config.js (1)
8-13: Consider using dynamic WebSocket configuration.The hardcoded WebSocket configuration might not work in all development environments. Consider using environment variables for hostname and port.
webSocketURL: { - hostname: "127.0.0.1", + hostname: process.env.WDS_SOCKET_HOST || "127.0.0.1", - port: 3000, + port: process.env.WDS_SOCKET_PORT || 3000, protocol: "ws", },app/client/craco.build.config.js (1)
79-84: Consider enabling babel cache for faster builds.Disabling
cacheDirectorymight impact build performance. Unless there's a specific reason, consider enabling it.babel: { plugins: ["babel-plugin-lodash"], loaderOptions: { - cacheDirectory: false, + cacheDirectory: true, }, },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/client/build.sh(1 hunks)app/client/craco.build.config.js(1 hunks)app/client/craco.common.config.js(0 hunks)app/client/craco.dev.config.js(1 hunks)
💤 Files with no reviewable changes (1)
- app/client/craco.common.config.js
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: perform-test / rts-build / build
- GitHub Check: client-lint / client-lint
- GitHub Check: client-build / client-build
- GitHub Check: client-prettier / prettier-check
🔇 Additional comments (3)
app/client/craco.dev.config.js (1)
21-32: LGTM! Webpack configuration looks good.The cache and optimization settings are appropriate for development builds. The filesystem cache with
memoryCacheUnaffectedwill improve build performance.app/client/craco.build.config.js (1)
85-89: LGTM! Smart handling of source maps.Good approach to conditionally enable source maps only for production builds.
app/client/build.sh (1)
21-21: Verify memory requirements for production builds.The reduction in
--max-old-space-sizefrom 10GB to 7GB might impact large production builds. Please ensure this has been tested with your largest production build scenario.✅ Verification successful
Memory allocation change appears intentional and beneficial
The change increases production build memory from 4GB to 7GB, while keeping local/staging builds at 4GB. This environment-specific optimization suggests careful consideration of memory requirements.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check the memory usage during build process # Get the total memory usage during a test build { time REACT_APP_ENVIRONMENT=PRODUCTION craco --max-old-space-size=7168 build --config craco.build.config.js; } 2>&1 | grep "maxRss"Length of output: 13
Script:
#!/bin/bash # Check git history for memory-related changes in build scripts git log -p -- "**/build.sh" | grep -B 5 -A 5 "max-old-space-size" # Search for any other memory configurations in build files fd -e js -e json -e sh | xargs rg "max-old-space-size" # Look for build-related configuration files fd "craco|webpack" -e js -e jsonLength of output: 538
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/client/craco.dev.config.js (1)
8-13: Consider using environment variables for WebSocket configuration.The hardcoded WebSocket configuration might not work in all development environments. Consider making these values configurable through environment variables.
webSocketURL: { - hostname: "127.0.0.1", - pathname: "/ws", - port: 3000, + hostname: process.env.WS_HOST || "127.0.0.1", + pathname: process.env.WS_PATH || "/ws", + port: process.env.WS_PORT || 3000, protocol: "ws", },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/client/build.sh(1 hunks)app/client/craco.build.config.js(1 hunks)app/client/craco.common.config.js(0 hunks)app/client/craco.dev.config.js(1 hunks)
💤 Files with no reviewable changes (1)
- app/client/craco.common.config.js
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: build
- 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-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-build / client-build
- GitHub Check: client-prettier / prettier-check
🔇 Additional comments (4)
app/client/craco.dev.config.js (1)
21-32: LGTM: Webpack configuration restructuring.The reorganization of cache and optimization settings under webpack.configure improves configuration clarity and maintainability.
app/client/craco.build.config.js (2)
79-84: Reconsider disabling Babel cache directory.Disabling the Babel cache directory (
cacheDirectory: false) might significantly impact build performance. Unless there's a specific reason, consider keeping it enabled.Could you explain the rationale behind disabling the Babel cache directory?
85-89: LGTM: Source map configuration aligns with PR objectives.The conditional source map generation (
devtool: env === "PRODUCTION" ? "source-map" : false) effectively implements the requirement to disable source maps for non-production builds.app/client/build.sh (1)
21-21: Verify memory requirements for reduced heap size.The reduction in
--max-old-space-sizefrom 10240MB to 7168MB might impact large builds. Please ensure this was tested with a full production build including all features.
|
/build-deploy-preview skip-tests=true |
|
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12810542557. |
|
Deploy-Preview-URL: https://ce-38706.dp.appsmith.com |
| // Jest module mapper which will detect our absolute imports. | ||
| "^@test(.*)$": "<rootDir>/test$1", | ||
| }, | ||
| devtool: env === "PRODUCTION" ? "source-map" : false, |
There was a problem hiding this comment.
@KelvinOm can you also change the condition for faros sourcemap plugin? It's enabled for STAGING and PRODUCTION now.
There was a problem hiding this comment.
@dvj1988 Do you mean to remove check for STAGING and leave it only PRODUCTION? I.e. the condition will be like this?
if (env === "PRODUCTION") {
plugins.push(
new FaroSourceMapUploaderPlugin({...}),
);
}
9c9d523 to
80b63a6
Compare
…gs (appsmithorg#38706) ## Description - reduce --max-old-space-size to 7168 for build. [Test for EE here](appsmithorg/appsmith-ee#5932). - disable sourcemaps for non-prod build - cleanup craco configs ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12825105662> > Commit: 80b63a6 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12825105662&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank">Cypress dashboard</a>. > Tags: @tag.All > Spec: > The following are new failures, please fix them before merging the PR: <ol> > <li>cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js</ol> > <a href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master" target="_blank">List of identified flaky tests</a>. > <hr>Fri, 17 Jan 2025 09:34:32 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Configuration Updates** - Reduced memory allocation for the build process. - Updated Webpack configuration with Brotli compression. - Modified WebSocket settings for the development server. - Streamlined build configuration by removing unnecessary sections. - **Performance Optimization** - Adjusted build memory limits. - Improved compression algorithm for build artifacts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Caution
🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12825105662
Commit: 80b63a6
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:
- cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js
List of identified flaky tests.Fri, 17 Jan 2025 09:34:32 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Configuration Updates
Performance Optimization