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

Customizable chunk splitting behavior #2317

Closed
fabiospampinato opened this issue Jun 14, 2022 · 5 comments
Closed

Customizable chunk splitting behavior #2317

fabiospampinato opened this issue Jun 14, 2022 · 5 comments

Comments

@fabiospampinato
Copy link

WebPack has some options for customizing how chunks will be generated (https://webpack.js.org/plugins/split-chunks-plugin/#optimizationsplitchunks) and I think it'd be useful to port (some?) of them over.

In particular I miss the "minSize" option, which tells the bundler to not make chunks below the set size threshold basically. That's pretty useful because for example for my use case I'd rather always pay 0.5kb of bundle size for something rather than pay a network request for it in the future.

@petterek
Copy link

petterek commented Jul 21, 2022

👍
Maybe being able to mark an import as 'do not do code splitting on this'.
Could use a comment, but sounds kinda funky..

import { LitElement, html, nothing } from "lit";
import { customElement, property } from 'lit/decorators.js';

//no-code-split
import {ViewModel } from './ViewModel'; //no-code-split
import { ActiveKeysFromIndexTypeRESTApi } from './PanelDataFromRESTApi'; 
//end

or something like that..

@petterek
Copy link

Another idea..
Set a threshold to the number of times a file needs to be referred before splitting it out..

splitting: true, 2

@joker-777
Copy link

joker-777 commented Sep 21, 2022

I really would like to support this idea. We just tried out esbuild by replacing webpack in our project with esbuild. The build time is way faster but the loading time of the website is a lot slower because it has to load 60 different js files instas of 20 with webpack. We use Webpacks maxInitialRequests: 2 split option.

Screenshot_20220922_121443

@dzearing
Copy link

Dupe of #1128

@fabiospampinato
Copy link
Author

Closing in favor of #1128

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

No branches or pull requests

4 participants