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

Optimize js files sent #9553

Closed
PlopTheReal opened this issue Mar 29, 2023 · 4 comments
Closed

Optimize js files sent #9553

PlopTheReal opened this issue Mar 29, 2023 · 4 comments

Comments

@PlopTheReal
Copy link

Describe the problem

My goal is to optimize the payloads and reduce the number of requests in a prod build.
Here are the requests on a page load from the route routes/[...catchall]:
image

My rollupOptions that reduces the number of chunks are the following:

rollupOptions: {
	output:{
	 manualChunks: (id)=> {
	    const chunks = [
		  'routes/+layout.svelte',
		  'routes/+error.svelte',
		  '...catchall]/+page.svelte',
		  '/components/critical/']
	       for (const chunkName of chunks) {
		   if (id.includes(chunkName)) {
			 return "m"
		}
	}
},

In the previous capture m.xxx.js are the merged chunks.

We can see those extra js files:
start.xxx.js
app.xxx.js
_layout.svelte.xxx.js
_...catchall_-page.svelte.xxx.js
0.xxx.js
1.xxx.js
2.xxx.js

Also some of them are nearly empty and probably don't require an extra request.

// _layout.svelte.xxx.js
import{O as f}from"../chunks/m.d03737c2.js";export{f as default};
// _...catchall_-page.svelte.xxx.js
import{R as f}from"../chunks/m.d03737c2.js";export{f as default};
// 0.xxx.js
import{O as m}from"./m.d03737c2.js";export{m as component};
// 1.xxx.js
import{Q as m}from"./m.d03737c2.js";export{m as component};
// 2.xxx.js
import{R as m}from"./m.d03737c2.js";export{m as component};

The page loaded is from [...catchall] route:
image

Describe the proposed solution

Remove / merge as much js files as possible.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

@PlopTheReal
Copy link
Author

I've just spotted that this one is related to ##9520 and ##3882

@dummdidumm
Copy link
Member

Closing in favor of those referenced issues

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2023
@PlopTheReal
Copy link
Author

PlopTheReal commented Mar 29, 2023

feels sad, looks I've provided a bit more 'up to date' details / insights in this one.

@dummdidumm
Copy link
Member

No worries, it's not for nothing! The referenced issues do link back to this one so we will not lose sight of the details in here.

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

2 participants