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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMR with parcel in 1.2.6 #705

Closed
mistakenelf opened this issue Jun 9, 2018 · 14 comments
Closed

HMR with parcel in 1.2.6 #705

mistakenelf opened this issue Jun 9, 2018 · 14 comments
Labels
bug Something isn't working

Comments

@mistakenelf
Copy link

Parcel with 1.2.5 works great with HMR. With the update to 1.2.6 for some reason HMR is broken and I have to restart the app every time I save something?

@jorgebucaran
Copy link
Owner

@knipferrc I'd like to get to the bottom of this and find a fix if there's really an issue. I have a similar problem with parcel, but only when developing Hyperapp, not with Hyperapp. Could you investigate more?

@jorgebucaran jorgebucaran added bug Something isn't working NEEDS FEEDBACK labels Jun 9, 2018
@jorgebucaran
Copy link
Owner

jorgebucaran commented Jun 9, 2018

@knipferrc What's the error message by the way?

I'm seeing this a lot (almost every time I change Hyperapp source code), not my app's code.

Cannot read property '__esModule' of null

parcel-bundler/parcel#927

@mistakenelf
Copy link
Author

Yeah sure I can investigate. I actually dont get any errors.

@mistakenelf
Copy link
Author

Honestly I have no idea what I did but it seems to be working now for some reason.

@jorgebucaran
Copy link
Owner

Actually, same here, true story. Very odd. 😆

@aminnairi
Copy link

aminnairi commented Jun 20, 2018

Same here, writing garbage code do trigger the error overlay but once fixed or on adding new lines of code HMR does not seem to trigger the page reload. Reloading manually the page still shows the updates though. Hope this feedback helps as I can't investigate any further.

@jorgebucaran
Copy link
Owner

@aminnairi I haven't had the same error again. I can edit apps, as well as Hyperapp's source—which I'm modifying a lot as I prepare to release 2.0α—and everything works like a charm.

I can't suggest anything concrete since I don't know what fixed things for me, but try removing parcel's cache, node_modules/ and reinstalling dependencies again.

@aminnairi
Copy link

aminnairi commented Jun 21, 2018

I tried removing the cache, using the --no-cache option, removing the node_modules folder and ran yarn again with no luck. Everything seems to be working except the live reloading which is just a minor inconvenience. I guess this will be fixed when the 2.x.x.

@jorgebucaran
Copy link
Owner

Thanks, @aminnairi. To clarify, you do mean parcel 2.x?

@aminnairi
Copy link

No, I'm currently using the version 1.9.2 from Parcel. I added it with yarn add --dev parcel-bundler. I'll try with version 2 if I can add it to my packages.

@jorgebucaran
Copy link
Owner

@aminnairi Ah, okay. I meant when you commented:

I guess this will be fixed when the 2.x.x

You mean parcel 2.x.x and not Hyperapp 2.x.

@aminnairi
Copy link

Oh yes I meant parcel 2 !

@aminnairi
Copy link

aminnairi commented Jun 21, 2018

3rd attemp now working

Okay, I think i've an idea of why it was not working. I always tried to manually install hyperapp when it should be automatically installed by parcel-bundler (I guess there are some hooks, not really sure as I haven't digged into the core of parcel-bundler). The --no-cache could have helped also (not really 100% sure).

So now, everything is working fine, even the live reloading.

package.json

{
  "name": "ultra-secret-ultimate-package-final-extend-premium-deluxe-edition-final-v2",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "git@github.com:aminnairi/...",
  "author": "Amin NAIRI <nairi.amin@gmail.com>",
  "license": "MIT",
  "scripts": {
    "start": "parcel --no-cache index.html"
  },
  "dependencies": {
    "hyperapp": "^1.2.6", <--- Automatically installed by parcel
    "parcel-bundler": "^1.9.2"
  }
}

index.jsx

import { h, app } from 'hyperapp';

const Title = () => <h1>Amin NAIRI</h1>

app( {}, {}, () => (
  <Title />
), document.getElementById('app') );

index.html

<!doctype html>
<html>
  <head>
    <title>Amin NAIRI</title>
  </head>
  <body>
    <div id='app'></div>
  </body>
  <script src='index.jsx'></script>
</html>

@jorgebucaran
Copy link
Owner

Thanks, @aminnairi!

So now, everything is working fine, even the live reloading.

Great! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants