Skip to content

fix (html5): Limit html5 to generate one single bundle (no more chunks) to make it work in Safari 15 - #22817

Merged
antobinary merged 3 commits into
bigbluebutton:v3.0.x-releasefrom
gustavotrott:html5-single-bundle
Mar 31, 2025
Merged

antobinary merged 3 commits into
bigbluebutton:v3.0.x-releasefrom
gustavotrott:html5-single-bundle

Conversation

@gustavotrott

Copy link
Copy Markdown
Contributor

Since #22764, the client has been generating two separate bundles. To ensure the Safari bundle uses the same hash as the standard bundle, we renamed it—but the script still tries to load chunks using the old bundle name, causing an error.

This PR updates the webpack config to generate a single bundle (no extra chunks). This resolves the naming mismatch and avoids runtime errors.

The standard bundle size increases from 5.6MB to 6.8MB, but this tradeoff may be beneficial, as it avoids downloading additional chunks during a meeting—potentially improving performance.

Issue:

Loading chunk 446 failed.
(error: https://bbb/ 3.0.4 server/html5client/446.bundle.safari.js)
extraInfo.errorInfo_esobj.componentStack

Lazy
Player@https://BBB 3.0.4 server/html5client/bundle.3c83c873d2818f9162fa.safari.js:85906:10
Suspense
div
ReactPlayer@https://BBB 3.0.4 server/html5client/bundle.3c83c873d2818f9162fa.safari.js:86209:12

image

@gustavotrott gustavotrott added this to the Release 3.0 milestone Mar 27, 2025
@gustavotrott
gustavotrott requested a review from antobinary March 27, 2025 20:40
@coderabbitai

coderabbitai Bot commented Mar 27, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

Walkthrough

The pull request modifies the Webpack configuration by adding the LimitChunkCountPlugin, which is set to restrict the maximum number of chunks to one. This change is included in the plugins array of the configuration file. Additionally, the performance settings for maxAssetSize and maxEntrypointSize have been increased from 6,000,000 to 8,000,000. These updates change how assets are processed during the build, leading to a single output chunk and adjusted size limits for assets and entry points.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant WP as Webpack Build Process
    participant Plugin as LimitChunkCountPlugin

    Dev->>WP: Run build command
    WP->>Plugin: Apply chunk limit (maxChunks: 1)
    Plugin-->>WP: Enforce single chunk output
    WP->>Dev: Output bundled application (1 chunk)
Loading

Suggested reviewers

  • ramonlsouza

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
bigbluebutton-html5/webpack.config.js (1)

33-35: Consider making the chunk limit Safari-specific.

The LimitChunkCountPlugin is being applied to all browser targets, which increases the bundle size for all users. Since the issue is Safari-specific, consider moving this plugin to the Safari-specific part of the configuration to maintain optimal loading for other browsers.

const config = {
  entry: './client/main.tsx',
  output: {
    filename: isSafariTarget
      ? 'bundle.safari.js'
      : 'bundle.[fullhash].js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '',
  },
  cache: {
    type: 'filesystem',
    allowCollectingMemory: true,
    maxAge: 86400000,
  },
  devtool: 'source-map',
  plugins: [
-   new webpack.optimize.LimitChunkCountPlugin({
-     maxChunks: 1,
-   }),
    new HtmlWebpackPlugin({
      // ...
    }),
    // Other plugins...
  ],
  // ...
};

if (env === prodEnv) {
  config.mode = prodEnv;
  config.optimization = {
    minimize: true,
    minimizer: isSafariTarget ? [] : [new TerserPlugin()],
  };
+  if (isSafariTarget) {
+    config.plugins.push(
+      new webpack.optimize.LimitChunkCountPlugin({
+        maxChunks: 1,
+      })
+    );
+  }
  // ...
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd22a17 and 1719fd3.

📒 Files selected for processing (1)
  • bigbluebutton-html5/webpack.config.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (1)
bigbluebutton-html5/webpack.config.js (1)

33-35: Confirm cross-browser testing has been completed.

This change significantly alters how the application is bundled, which could impact loading behavior across different browsers and network conditions. While it fixes the Safari 15 issue, ensure thorough testing has been conducted across all supported browsers.

Have you confirmed that this change works correctly in all supported browsers, especially under different network conditions?

Comment thread bigbluebutton-html5/webpack.config.js Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
bigbluebutton-html5/webpack.config.js (1)

130-131: Appropriate performance limits adjustment.

Increasing the maxAssetSize and maxEntrypointSize from 6MB to 8MB is necessary to accommodate the larger bundle size (expected to grow from 5.6MB to 6.8MB as mentioned in the PR description). This change properly addresses the performance warnings concern raised in previous reviews.

Consider setting up monitoring for bundle size growth over time to ensure it doesn't exceed these new limits in future iterations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1719fd3 and 83a6a09.

📒 Files selected for processing (1)
  • bigbluebutton-html5/webpack.config.js (2 hunks)
🔇 Additional comments (1)
bigbluebutton-html5/webpack.config.js (1)

33-35: Good solution for Safari 15 compatibility.

Adding the LimitChunkCountPlugin with maxChunks: 1 successfully addresses the Safari 15 issue by forcing webpack to generate a single bundle instead of multiple chunks. This aligns perfectly with the PR objective of eliminating the naming mismatch that caused "Loading chunk" errors in Safari.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@antobinary
antobinary merged commit d7ef038 into bigbluebutton:v3.0.x-release Mar 31, 2025
imdt-claudiop added a commit to imdt-claudiop/bigbluebutton that referenced this pull request Oct 28, 2026
Mermaid, which the diagram block needs, is most of what the equation and
diagram blocks add to the client: with it in the bundle, bundle.js grew
from 9.46 MB to 13.20 MB (2.30 MB to 3.29 MB gzipped) for every user.

`mermaid` now resolves to a small stand-in that imports the real package
the first time a diagram is parsed or rendered. The regular build emits
Mermaid as separate chunks again; every other dynamic import stays in the
bundle (`dynamicImportMode: 'eager'`), as it has since chunks were
limited to one in bigbluebutton#22817. The Safari 14-15 build keeps that limit, so it
remains a single file with Mermaid inside.

Mermaid ships class static blocks, which Safari parses only from 16.4:
in a single bundle they kept the whole client from loading there. Mermaid
is now compiled for Safari 14 in both builds.

The diagram e2e test checks that both participants download Mermaid only
once a diagram is drawn.
imdt-claudiop added a commit to imdt-claudiop/bigbluebutton that referenced this pull request Oct 30, 2026
Mermaid, which the diagram block needs, is most of what the equation and
diagram blocks add to the client: with it in the bundle, bundle.js grew
from 9.46 MB to 13.20 MB (2.30 MB to 3.29 MB gzipped) for every user.

`mermaid` now resolves to a small stand-in that imports the real package
the first time a diagram is parsed or rendered. The regular build emits
Mermaid as separate chunks again; every other dynamic import stays in the
bundle (`dynamicImportMode: 'eager'`), as it has since chunks were
limited to one in bigbluebutton#22817. The Safari 14-15 build keeps that limit, so it
remains a single file with Mermaid inside.

Mermaid ships class static blocks, which Safari parses only from 16.4:
in a single bundle they kept the whole client from loading there. Mermaid
is now compiled for Safari 14 in both builds.

The diagram e2e test checks that both participants download Mermaid only
once a diagram is drawn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants