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.

Assets with the same content are de-duplicated at build time

See original GitHub issue

Describe the bug

Hi! I have many assets like svg and their [content] is the same. After vite build, I only got two svg. The rest have been merged together. I checked the code of vite in https://github.com/vitejs/vite/blob/2b7e836f84b56b5f3dc81e0f5f161a9b5f9154c0/packages/vite/src/node/plugins/asset.ts#L325. Is this made wrong? Or is this the default behavior of rollup. How can I get all assests after build? I don’t want chunk splitting.

Reproduction

https://stackblitz.com/edit/vitejs-output-file-paths-gftt9h?file=dist/manifest.json

System Info

vite 2.9.12

Used Package Manager

pnpm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
hemengke1997commented, Oct 29, 2022

@hemengke1997 Yes I understand the difference. But we didn’t understand why you need to avoid the dedupe of the actual file. Would you provide more context about that?

I am trying to cache packed results. Because my project structure is multi-page, and each page is not directly related, the speed will be slower every time it is fully bundled, so I need know whether the file needs to be removed from the cache by controlling the hash. And multi-asset merging will cause cache instability. My need is very rare, so I don’t think there is any need to modify the vite source code. At first I thought it was a vite bundle bug. But I now think merging assets is reasonable for the vast majority of projects. Thank you for your enthusiasm and responsibility

1reaction
sapphi-redcommented, Oct 29, 2022

@hemengke1997 Yes I understand the difference. But we didn’t understand why you need to avoid the dedupe of the actual file. Would you provide more context about that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I avoid duplicate assets in a DAM?
If two assets have the same checksum, they are exact duplicates. How does it work with assets? Add a period in a text...
Read more >
Deduplication/merging of mutable data in Python
My script is supposed to query each of them, gather that data, deduplicate it by merging info about the same assets from different...
Read more >
Using the Amazon SQS message deduplication ID
Messages sent with identical content but different message attributes that Amazon SQS must ... The deduplication process in FIFO queues is time-sensitive.
Read more >
How best to avoid asset duplication? (VM & Agent)
Hi Folks, I was hoping to hear how some of you avoid ending up with duplicate assets (cloud agent & ip asset imported...
Read more >
BigQuery Deduplication
Do you ever get duplicate rows in BigQuery? I'm going to explore some techniques for deduplication in BigQuery both for the whole table...
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