Skip to content

2494 load extra bundles #3689

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

Merged
merged 22 commits into from
Mar 29, 2022
Merged

2494 load extra bundles #3689

merged 22 commits into from
Mar 29, 2022

Conversation

ValJed
Copy link
Contributor

@ValJed ValJed commented Mar 22, 2022

PRO-2494

Summary

  • Adds check at init time for webpack bundles config that throw error if badly configured.
  • Removes the use of stylesheet and scripts helpers but keep them empty for BC
  • Generates placeholder at the right places at page load using async components
  • In output method depending on the loaded widgets, load the rights bundles
  • In renderPageForModule, check page config to load the right bundles.
  • In renderPageForModule insert computed stylesheet and scripts tagsin the page.
  • If the user is logged in every page get all the bundles.

What are the specific steps to test this change?

Can be tested in testbed with the branch pro-2494-bundles.

  • common-tags is imported in main bundle and in topic bundle, check in public that it exists only in the main bundle.
  • An alias has been added in topic-page module and is impoted in topic.js check that alias work. You can try override it in another module for example.
  • Check that the bundles are loaded on the right pages. for topic pages, Topic bundle should be loaded only on the index page, not on the show one.
  • You can add a topic-widget on the home page, publish and once logged out, check that the widget bundle is properly loaded.
  • Finally, login and check that all bundles are loaded on all pages.

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

@ValJed ValJed self-assigned this Mar 22, 2022
@ValJed ValJed marked this pull request as draft March 22, 2022 17:11
@ValJed ValJed marked this pull request as ready for review March 24, 2022 14:39
@ValJed ValJed requested a review from boutell March 28, 2022 12:13
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

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

How hard would it be to factor this so that you're not relying on "self" to hold a reference to "extraBundles"? I know we can't test es5 builds successfully right now but I am concerned that we already know this is the wrong factoring because there can only be one "self.extraBundles.js" but those files and names are going to be different in the ES5 output. I think we should be getting the namespacing right from the beginning, even if we can't successfully test ES5 right now.

@ValJed ValJed requested a review from boutell March 28, 2022 16:33
@ValJed ValJed merged commit 80ae7a9 into webpack-feature Mar 29, 2022
@ValJed ValJed deleted the 2494-load-extra-bundles branch March 29, 2022 07:51
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