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

Hot reload does not work when first js entry is external #6571

Open
pickfire opened this issue Jul 9, 2021 · 1 comment
Open

Hot reload does not work when first js entry is external #6571

pickfire opened this issue Jul 9, 2021 · 1 comment
Labels

Comments

@pickfire
Copy link

pickfire commented Jul 9, 2021

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "playground",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "parcel serve index.html"
  },
  "devDependencies": {
    "parcel": "^2.0.0-beta.3.1"
  }
}

🤔 Expected Behavior

<script> ordering should not matter and hot-reloading should work no matter how scripts are ordered.

😯 Current Behavior

<!DOCTYPE html>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>console.log(1)</script>
<p>hello, world</p>

Change to <p> does cause html to be reloaded if first <script> is external, only if I swap first <script> to a local script then it will work. But this worked because local <script> is the first entry.

<!DOCTYPE html>
<script>console.log(1)</script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<p>hello, world</p>

💁 Possible Solution

Maybe parcel does not iterate through <script>?

🔦 Context

I was using 3rd party js dependencies then it stopped working.

💻 Code Sample

<!DOCTYPE html>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>console.log(1)</script>
<p>hello, world</p>

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-beta.3.1
Node
npm/Yarn v1.22.10
Operating System Linux mi 5.12.14-zen1-1-zen #1 ZEN SMP PREEMPT Thu, 01 Jul 2021 03:35:38 +0000 x86_64 GNU/Linux
@mischnic mischnic added the HMR Hot Module Reloading label Dec 2, 2021
@tarciozemel
Copy link

+1 for this.

This bug drops a considering part of Parcel's power on dev envs (and make Parcel not to be an dev option to consider).

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

No branches or pull requests

4 participants