We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What is the current behavior? I am experiencing issues while using webpackPreload. No script with rel="preload" is added to the <head>.
webpackPreload
rel="preload"
<head>
Steps to reproduce
const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: 'none', plugins: [ new HtmlWebpackPlugin({template: './src/index.html'}), ] };
export function divide(a, b) { return a / b; }
document.addEventListener("DOMContentLoaded", () => { const button = document.querySelector('#divideButton'); button.addEventListener('click', () => { import( `./utilities/divide` /* webpackPreload: true */ /* webpackChunkName: "utilities" */ ) .then(divideModule => { console.log(divideModule.divide(6, 3)); // 2 }) }); });
<!DOCTYPE html> <html> <head> </head> <body> <button id="divideButton">Click</button> </body> </html>
I am using webpack@4.16.5.
webpack@4.16.5
What is the expected behavior? I expect the <link rel="preload" as="script" href="utilities.js"> to be added.
<link rel="preload" as="script" href="utilities.js">
Other relevant information: webpack version: 4.16.5 Node.js version: 8.11.3 Operating System: Ubuntu 18.04
This issue was moved from webpack/webpack#7920 by @sokra. Original issue was by @mwanago.
@sokra The docs do not mention the need to use html-plugin for preload. Prefetch is working without problems. https://webpack.js.org/guides/code-splitting/#prefetching-preloading-modules
That's true. It's mentioned here: https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c in the FAQ Please send a PR to the docs adding it.
That's true. It's mentioned here: https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c in the FAQ
Please send a PR to the docs adding it.
The text was updated successfully, but these errors were encountered:
Hi @mwanago , you will work on this?
Sorry, something went wrong.
Closing this issue, PR: webpack/webpack/pull/7444 had "fixed" the behaviour mentioned in caveat when prefetch/preload did not work for entry chunk.
And, entryPrefetchFunction wasn't merged, it was changed so there is nothing to document here.
entryPrefetchFunction
Just ran into this problem. Prefetch works, preload does not.
"webpack": "4.28.3",
No branches or pull requests
What is the current behavior?
I am experiencing issues while using
webpackPreload
.No script with
rel="preload"
is added to the<head>
.Steps to reproduce
I am using
webpack@4.16.5
.What is the expected behavior?
I expect the
<link rel="preload" as="script" href="utilities.js">
to be added.Other relevant information:
webpack version: 4.16.5
Node.js version: 8.11.3
Operating System: Ubuntu 18.04
This issue was moved from webpack/webpack#7920 by @sokra. Original issue was by @mwanago.
The text was updated successfully, but these errors were encountered: