question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimize produced bundles for Anonymous users

See original GitHub issue

There are some opportunities to further shrink the generated bundle with the techniques described here: https://webpack.js.org/guides/lazy-loading/

We’ve been using this technique for a custom implementation that uses ckeditor:

  componentDidMount() {
    import(/* webpackChunkName: 'ckeditor' */ '@ckeditor/ckeditor5-react').then(
      module => this.setState({ CKEditor: module.default }),
    );
    import(
      /* webpackChunkName: 'classiCk' */ '@ckeditor/ckeditor5-build-classic'
    ).then(module => this.setState({ ClassicEditor: module.default }));
  }

And then in component rendering we use this.state.ClassicEditor and such to render the CKEditor component. This causes Webpack to split those resources in a separate chunk that’s loaded on demand when the parent components is first mounted.

As the bigger candidates in Volto’s case, I see the draftjs editor (which will also include immutable.js) and the DND support, I think it’s react-dnd.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
pnicollicommented, Jan 29, 2020

@tiberiuichim the chunks are loaded on-demand with loadable-components. It is based on the same dynamic imports you suggested above.

0reactions
sneridaghcommented, Apr 11, 2020

After #1365

Screenshot 2020-04-11 at 16 44 23 Screenshot 2020-04-11 at 16 44 29 Screenshot 2020-04-11 at 16 44 35
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Optimize Returns for Product Bundles - Narvar
Product bundles made up of variations on a single item can be a great way for shoppers to try new styles, flavors, or...
Read more >
Analyze your React app's bundle size and reduce it using ...
An app's bundle size is the amount of JavaScript a user will have to download to load your app. The bigger the bundle...
Read more >
Reactjs Build Production: Optimize Performance - CopyCat Blog
In this article, we will be taking a deep dive into the Reactjs build production, deployment, and tips on optimising your app's performance....
Read more >
How We Reduced Startup Time by 80% With Webpack
Enter webpack · 1. Install required dependencies · 2. Create and export your config file · 3. Add config to instruct webpack where...
Read more >
How can I configure Webpack for better optimization? Error ...
How can I configure Webpack for better optimization? Error: Conflict: Multiple chunks emit assets to the same filename main.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found