Similar works like https://webpack.js.org/api/module-methods/#magic-comments
Most codes inspired from https://github.com/CaptainLiao/vite-plugin-webpackchunkname
Support follow magic comments:
webpackChunkName
orchunkName
- define chunk namewebpackPrefetch
orprefetch
- transformindex.html
, add prefetch link into html metawebpackPreload
orpreload
- transformindex.html
, add preload link into html meta
import(
/* webpackChunkName: my-chunk-name */
/* webpackPreload: true */
/* webpackPrefetch: true */
"module"
)