PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.03k stars 346 forks source link

[BUG] Uncaught SyntaxError: Unexpected identifier 'HMR' #858

Open aiktb opened 7 months ago

aiktb commented 7 months ago

What happened?

React HMR does not work and reports the error "Uncaught SyntaxError: Unexpected identifier 'HMR'".

After changing the TSX source code, the page flashes, but the page is not updated, and the page needs to be refreshed to observe the update.

image image

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

Relevant log output

🟡 6      | @plasmohq/parcel-optimizer-encapsulate static\background\index.js static\background\index.js
🟡 12     | @plasmohq/optimizer-es:  static\background\index.js static\background\index.js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 13     | optimizer-es: skipped
🟡 2      | @plasmohq/parcel-packager
🟡 7      | @plasmohq/parcel-optimizer-encapsulate kanjiTokenizer.15411dc3.js kanjiTokenizer.[hash].js
🟡 14     | @plasmohq/optimizer-es:  kanjiTokenizer.15411dc3.js kanjiTokenizer.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 15     | optimizer-es: skipped
🟡 8      | @plasmohq/parcel-optimizer-encapsulate furiganaMaker.6287d297.js furiganaMaker.[hash].js
🟡 16     | @plasmohq/optimizer-es:  furiganaMaker.6287d297.js furiganaMaker.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 17     | optimizer-es: skipped
🟡 6      | @plasmohq/parcel-optimizer-encapsulate core.f5001132.js core.[hash].js
🟡 6      | @plasmohq/parcel-optimizer-encapsulate options.526298b9.js options.[hash].js
🟡 12     | @plasmohq/optimizer-es:  options.526298b9.js options.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 13     | optimizer-es: skipped
🟡 7      | @plasmohq/parcel-optimizer-encapsulate pageMarker.aac3a90a.js pageMarker.[hash].js
🟡 14     | @plasmohq/optimizer-es:  pageMarker.aac3a90a.js pageMarker.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 15     | optimizer-es: skipped
🟡 8      | @plasmohq/parcel-optimizer-encapsulate customSelector.3a7c0556.js customSelector.[hash].js
🟡 16     | @plasmohq/optimizer-es:  customSelector.3a7c0556.js customSelector.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 17     | optimizer-es: skipped
🟡 12     | @plasmohq/optimizer-es:  core.f5001132.js core.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 13     | optimizer-es: skipped
🟡 7      | @plasmohq/parcel-optimizer-encapsulate eventHandler.f45c405d.js eventHandler.[hash].js
🟡 14     | @plasmohq/optimizer-es:  eventHandler.f45c405d.js eventHandler.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 15     | optimizer-es: skipped
🟡 8      | @plasmohq/parcel-optimizer-encapsulate popup.7d3dc21e.js popup.[hash].js
🟡 16     | @plasmohq/optimizer-es:  popup.7d3dc21e.js popup.[hash].js C:\Users\aikotoba\Documents\GitHub\FuriganaMaker
🟡 17     | optimizer-es: skipped
🟢 DONE   | Extension re-packaged in 1255ms! 🚀

(OPTIONAL) Contribution

Code of Conduct

hhmy27 commented 3 months ago

same

aiktb commented 3 months ago

same

I built 3 extensions with plasmo, and I actually found that HMR only works when the page is very simple, and you almost have to refresh to see the updates.