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

[Feature request] Improve shouldPrefetch and shouldPrefetch option #952

Open
Mister-Hope opened this issue Jun 15, 2022 · 2 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Mister-Hope
Copy link
Member

Mister-Hope commented Jun 15, 2022

Clear and concise description of the problem

Currenly the (file: string, type: string) => boolean is TOO unmeaningful.

The file args in vite is the output chunk name, which is probably like index.html.xxxx.js.

image

It lost infoamtion about how it was generated, so users at this time have No idea about what's page is this chunk generated from. So it's impossible for a developer or a user to take actual effect when setting a function.

Just an example, I am getting hundreds of index.html.xxxx.js in https://github.com/vuepress-theme-hope/v2/tree/gh-pages/assets.

image

Suggested solution

The parameters should be rebuilt. At least it should include:

  • chunk filename

  • chunk filetype (can be ommited if filename contains extension). Also I am confused why current api seperate a full chunk path into file name and file type.

  • chunk infomation about how this chunk is generated.

    Could be things like:

{from: 'markdown', source: 'path/to/markdown.md'}
{from:'import', source: 'path/to/files/where/the/chunk/is/imported.ts'}
{from:'script', source: 'path/to/file/entry.ts'}

Edited: In some cases we might get an array here, so we can use array formats.

Alternative

No response

Additional context

No response

@github-actions
Copy link

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 3 days.

@Mister-Hope Mister-Hope reopened this Jun 26, 2022
@Mister-Hope Mister-Hope added enhancement New feature or request and removed stale labels Jun 26, 2022
@rockbenben
Copy link

I feel the same way. Sometimes the file doesn't change, but once rebuild, a bunch of files change their names, and you can't find difference in different commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants