-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Parcel injects a bogus script tag when a link points to an HTML page involving inline CSS #3008
Comments
@andy0130tw That JS file is added to provide hot reloading (update the page) as you make changes to your source files. That JS file contains: There is no JS file with I guess the JS asset emitted by CSSAsset creates a JS bundle and hmr gets added to that. @DeMoorJasper Not sure if I would call this a bug. This is actually an edge case where HMR does indeed get injected without an explicit script file (#943). |
@mischnic didn't actually read the bug report in detail just added a tag to it. |
First of all, thanks @mischnic for pointing out that the extra script file is meant for HMR. Producing that file is an expected behavior. However, my issue is that the file is not generated in certain conditions. I am sorry for not being careful enough to fully describe my issue. To trigger this bug, the <!DOCTYPE html>
<html>
<head>
</head>
<body style="font-size: 24px">
<a href="register.html">AARRR</a>
</body>
</html> Building with This differs from the output I originally posted. Actually I invoked |
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. |
I have this same issue. I make use of parcel-plugin-inline-source to inline some of my css for faster initial page load. This gives me the same issues as soon as I link to another page. Is there really no way to inline css without |
Why this is closed when no answer has been provided? |
🐛 bug report
Parcel incorrectly injects a bogus script tag to a page which contains a link to an HTML page that involves inline CSS. When loading this page, the browser will try to load the non-existent resource, receiving a 404. See the following sample code.
🎛 Configuration (.babelrc, package.json, cli command)
No extra configs.
🤔 Expected Behavior
No script tags should be inserted.
😯 Current Behavior
As the sample code.
💁 Possible Solution
Inline CSS should not need an extra script file, unlike CSS stylesheets.
🔦 Context
N/A
💻 Code Sample
For example, there are two files:
The main page,
index.html
:Which has a link to the other page,
register.html
:Then use
parcel index.html
to generate a (dev) bundle. The source ofindex.html
is as follows:Despite the fact that there is obviously no
register.js
. Note that when building withparcel build index.html
, the bundle is perfectly fine.🌍 Your Environment
The text was updated successfully, but these errors were encountered: