pwa icon indicating copy to clipboard operation
pwa copied to clipboard

The resource http://localhost:8080/hot-update.js was preloaded using link preload but not used - warning

Open dortamiguel opened this issue 8 years ago • 14 comments
trafficstars

I'm getting the following warning.

The resource http://localhost:8080/0.8546b380a69e057e76d2.hot-update.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.

How can this be fixed?

dortamiguel avatar Nov 02 '17 16:11 dortamiguel

Yes, same here...

Garito avatar Nov 02 '17 16:11 Garito

Hi

This happens because the snippet we use to decide which files to preload or prefetch unintentionally catches the HMR specific files emitted by webpack during development.

This warning can be safely ignored as it will not happen in production builds.

Thanks

anubhav7495 avatar Nov 02 '17 16:11 anubhav7495

Any way to get rid of it?

Garito avatar Nov 02 '17 17:11 Garito

I usually have the console open and the warning gets my attention every time I open it, thinking there is a problem with my code. I think it's better to find a way to hide it.

dortamiguel avatar Nov 03 '17 08:11 dortamiguel

@ellipticaldoor @Garito You are welcome to submit a PR to fix this issue. Otherwise i will try to do this on this weekend. Thanks.

anubhav7495 avatar Nov 03 '17 08:11 anubhav7495

@anubhav7495 okay! I will try it, can you give me a hint? I'm not very familiar with the project

dortamiguel avatar Nov 03 '17 08:11 dortamiguel

<% for (var chunk of webpack.chunks) {
        for (var file of chunk.files) {
          if (file.match(/\.(js|css)$/)) { %>
    <link rel="<%= chunk.initial?'preload':'prefetch' %>" href="<%= htmlWebpackPlugin.files.publicPath + file %>" as="<%= file.match(/\.css$/)?'style':'script' %>"><% }}} %>

This snippet in index.html is responsible for preloading and prefetching. Ideal fix would be to somehow disable this in development.

anubhav7495 avatar Nov 03 '17 09:11 anubhav7495

Same problem with recently installed version :(

raulghm avatar Nov 14 '17 03:11 raulghm

Besides inline updates have stop to work You can notice it because the page is always reloading (losing state)

Garito avatar Nov 14 '17 04:11 Garito

@Garito you can test commenting this line in build/dev-server.js file? hotMiddleware.publish({ action: 'reload' })

Plus updating webpack to 3.8.1 if necessary and run again npm run dev

raulghm avatar Nov 14 '17 04:11 raulghm

@raulghm this solution solves the inline updating but maintains the warning in the console

So far I care more about inline updating that the console warning

so thanks

But will be nice to make this warning go away (more giving the fact that seems it has no impact at all)

Garito avatar Nov 14 '17 13:11 Garito

I came here trying to figure out why hot-reloading was not working for me. Commenting hotMiddleware.publish({ action: 'reload' }) as suggested made hot-reload work. Now I would like to make sure I'm not missing something by commenting that line!
Thanks

MatiasArriola avatar Nov 21 '17 12:11 MatiasArriola

Regarding @MatiasArriola's question, the fix should be https://github.com/vuejs-templates/pwa/pull/53 and will be deployed in the next release of this template.

jeffposnick avatar Nov 21 '17 19:11 jeffposnick

In my opinion https://github.com/vuejs-templates/pwa/pull/53 doesn't fully solve the problem. I synced my project with master and it didn't work. After commenting out hotMiddleware.publish({ action: 'reload' }) HMR started to work.

lukaszczerpak avatar Dec 08 '17 21:12 lukaszczerpak