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

manifest plugin: handle dynamic imports #1609

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Conversation

0xb4lint
Copy link
Contributor

I'm using vite with Vue 3 TS and lazy loading routes.

Previously (with vite 1) I was able to generate preload meta tags using shouldPreload() function, but now I'm trying to migrate this functionality to a custom plugin using the manifest.json file.

Currently the manifest plugin generates the following output:

{
  "index.js": {
    "file": "assets/index.47f0281f.js",
    "imports": []
  }
}

With this little PR the manifest.json will contain all the dynamic imports in the following way, allowing a much wider area of use:

{
  "index.js": {
    "file": "assets/index.47f0281f.js",
    "imports": [],
    "dynamicImports": [
      "assets/About.e27cd12c.js"
    ]
  },
  "About.js": {
    "file": "assets/About.e27cd12c.js",
    "imports": [
       "assets/index.47f0281f.js",
     ],
    "dynamicImports": []
  }
}

@yyx990803 yyx990803 merged commit 9ed4908 into vitejs:main Jan 20, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants