-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
feat: add support for link preload/prefetch #1043
Conversation
|
@alexander-akait is it ok to merge this one? |
Hi @alexander-akait |
@FogelAI Can you accept CLA? |
]), | ||
"}", | ||
])};` | ||
: "// no preloaded", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you copy this code from webpack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, with adjustments to CSS.
Except for the getLinkElements
function that I added (b785fd8).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to finish - webpack/webpack#18190, i.e. for built-in CSS support, then I will check code here, regaridng - getLinkElements
, it is an intresting question, because I think browsers make different things - webpack/webpack#17497, we need to report about to chrome bug tracker, if it is a bug, they need to fix it, if not - I will improve our code late
src/index.js
Outdated
`}`, | ||
`return loadedLinks;`, | ||
]), | ||
`};`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove getLinkElements
from here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be another investigation
src/index.js
Outdated
} = /** @type {Compilation} */ (this.compilation); | ||
const chunkMap = getCssChunkObject( | ||
/** @type {Chunk} */ (chunk), | ||
/** @type {Compilation} */ (this.compilation) | ||
); | ||
const { globalObject } = runtimeTemplate; | ||
const { linkPreload, linkPrefetch } = | ||
JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put these hooks here, i.e. just copy/paste, because this plugin can work not only with Jsonp, also with ESM modules
ee25e51
into
webpack-contrib:master
This PR contains a:
Motivation / Use-Case
This pull request adds webpackPrefetch and webpackPreload magic comments support of webpack at import() for css files, per this issue: #142.
It is also an alternative realization of #344 and #488 pull requests, which are not merged and are not active.
See also webpack/webpack#7056 pull request of webpack repository.
Breaking Changes
No breaking changes.
Additional Info