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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: HTML file is not updated on update; .cache has stale copy #1789

Closed
hrgui opened this issue Jul 25, 2018 · 13 comments
Closed

bug: HTML file is not updated on update; .cache has stale copy #1789

hrgui opened this issue Jul 25, 2018 · 13 comments

Comments

@hrgui
Copy link

hrgui commented Jul 25, 2018

馃悰 bug report

Repo

  1. Run parcel index.html
  2. Change apple.html (add some numbers)

馃帥 Configuration (.babelrc, package.json, cli command)

None, ran parcel index.html

馃 Expected Behavior

Would expect the console.log to have the updated version of the HTML updated file

馃槸 Current Behavior

The console.log never updates with the latest version of apple.html despite the page knowing there was an update

馃拋 Possible Solution

The only workaround right now is to remove the .cache directory and rerun parcel.

馃敠 Context

Trying out AngularJS experience with Parcel. AngularJS requires HTML templates; but even without AngularJS Parcel does not reload HTML files correctly.

馃捇 Code Sample

index.js

const apple = require('./apple.html');
console.log(apple);

apple.html

<h1>test224443331111112</h1>

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script src="./index.js"></script>
</body>
</html>

馃實 Your Environment

Software Version(s)
Parcel using github repo and link
Node 8.3.0
npm/Yarn 1.5.1
Operating System MacOS
@hrgui hrgui changed the title HTML file does not trigger reload, requires .cache to be deleted HTML file is not updated; .cache has stale copy Jul 25, 2018
@hrgui hrgui changed the title HTML file is not updated; .cache has stale copy HTML file is not updated on update; .cache has stale copy Jul 25, 2018
@hrgui hrgui changed the title HTML file is not updated on update; .cache has stale copy bug: HTML file is not updated on update; .cache has stale copy Jul 25, 2018
@Abandon99
Copy link

The same problem for me .... Do you solve that?

@DeMoorJasper
Copy link
Member

Could you guys try it with the latest stable parcel? (1.9.7)

@hrgui
Copy link
Author

hrgui commented Aug 1, 2018

@DeMoorJasper I was using the build version and used yarn link.

I'll retry with the stable 1.9.7 when I get a chance and comment again

@DeMoorJasper
Copy link
Member

Not sure if any of the latest commits can cause this issue.

If you can provide a test repo, I can fiddle around with it a bit

@hrgui
Copy link
Author

hrgui commented Aug 2, 2018

@DeMoorJasper stable v1.9.7 has a different issue

Here's the repo: https://github.com/hrgui/parcel-html-bug

run yarn start

const apple = require('./apple.html');
console.log(apple);

Expected

<h1>test22444333111114443312131322</h1>

to be printed in console log

Actual

Uncaught (in promise) Error: Cannot find module 'apple.html'
    at newRequire (learn-parcel.b5f3a9c8.js:39)
    at newRequire (learn-parcel.b5f3a9c8.js:23)
    at localRequire (learn-parcel.b5f3a9c8.js:54)
    at Object.parcelRequire.index.js../apple.html (index.js:1)
    at newRequire (learn-parcel.b5f3a9c8.js:48)
    at localRequire (learn-parcel.b5f3a9c8.js:54)
    at index.js:2

@DeMoorJasper
Copy link
Member

@hrgui yeah, that makes sense as the html bundle loader, got pushed to master after 1.9.7 and will be part of the next release

@hrgui
Copy link
Author

hrgui commented Aug 3, 2018

yarn link parcel-bundler gives me exactly the error that I have described

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Aug 7, 2018

After a bit of debugging I came to the discovery that the changes for processing inline styles and scripts inside html caused generate to output an empty array in most cases, the hash gets calculated based on the output of generate, so in this case an empty hash...

Fixed it by adding the asset content to the hash

@DeMoorJasper
Copy link
Member

Please try out #1861

@hrgui
Copy link
Author

hrgui commented Aug 9, 2018

@DeMoorJasper It works out perfectly!

One note:

screen shot 2018-08-08 at 9 05 00 pm

is it always supposed to be in a loading state?

@DeMoorJasper
Copy link
Member

It's not supposed to be in a constant loading state, not sure why that's happening, it worked for me. Feel free to debug it

@hrgui
Copy link
Author

hrgui commented Aug 9, 2018

@DeMoorJasper it has to do w/ the websocket left open, not sure why

probably its something ive done

@DeMoorJasper
Copy link
Member

Yeah probably, glad the content hash resolved the issue though :)

Sent with GitHawk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants