Parcel: HMR not working with PostHTML Modules

Created on 10 Jul 2019  ยท  6Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

When using PostHTML Modules for templating, modifying a partial html file doesn't trigger HMR as it should.

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

My .posthtmlrc file:

{
  "plugins": {
    "posthtml-modules": {
      "root": "./web"
    },
    "posthtml-expressions": {
      "root": "./web"
    }
  }
}

and my package.json's devDependencies:

"devDependencies": {
  "@babel/core": "^7.5.4",
  "mocha": "^6.1.4",
  "parcel-bundler": "^1.12.3",
  "posthtml-expressions": "^1.1.1",
  "posthtml-modules": "^0.4.2",
  "sass": "^1.22.3"
}

๐Ÿค” Expected Behavior

Editing a partial html file included as a PostHTML module should trigger HMR.

๐Ÿ˜ฏ Current Behavior

Nothing happens when the partial html file is edited.

๐Ÿ’ Possible Solution

Maybe Parcel isn't following PostHTML modules' paths or something? I'm not sure.

๐Ÿ”ฆ Context

Just trying to utilize HMR when developing - it makes my life easier.

๐Ÿ’ป Code Sample

https://github.com/w-biggs/1212 is the repo; https://github.com/w-biggs/1212/blob/master/web/index.html is the entry HTML file.

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.12.3 |
| posthtml-modules | 0.4.2 |
| Node | 11.14.0 |
| npm/Yarn | 6.9.2 |
| Operating System | Ubuntu 18.04.1 LTS (WSL) |

Bug HMR

Most helpful comment

Why has this been marked as closed? Seems like the issue hasn't been fixed.

All 6 comments

Experiencing this issue as well ๐Ÿ˜ฅ๏ธ

I made a hacky workaround that updates index.html whenever a change is detected in one of the modules.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

FWIW this is still an issue, I'm experiencing it as well.

Why has this been marked as closed? Seems like the issue hasn't been fixed.

Or you can just update the index.html to trigger a change in the module if you use the module from index.html.

_Very important_: using dash/hyphen - inside a module as a name for a local variable binding like {{my-variable}} breaks the code.

Yup, the issue still exists in 2.0.0-nightly.469 and I can confirm that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jzimmek picture jzimmek  ยท  3Comments

oliger picture oliger  ยท  3Comments

devongovett picture devongovett  ยท  3Comments

dotdash picture dotdash  ยท  3Comments

philipodev picture philipodev  ยท  3Comments