Parcel: Colon character and <pre> tags added

Created on 27 Mar 2019  路  3Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

Parcel is adding a <pre>:</pre> tag to all of my served sites.

This tag being added through a javascript function called by the hmr-runtime.js app generated by parcel, specifically the createErrorOverlay(data) function. This function is called higher up in the script when websockets are undefined and data.type === 'error'. The calling function is supposed to be doing a console.log() of the error via console.error('[parcel] 馃毃 ' + data.error.message + '\n' + data.error.stack);, but this isn't outputting.

I have tested this on an extremely minimal set up - installing parcel-bundler alone with nothing else, a barebones index.html, and a simplistic app.js that only runs a single console.log().

This error shows through even when I attempt to access the localhost site in an anonymous browser window (i.e. no extensions running that would affect it).

馃帥 Configuration (.babelrc, package.json, cli command)

node version 11.9.0

package.json
{
    "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "parcel src/index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel-bundler": "^1.12.3"
  }
}
<!-- index.html -->
:<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
</head>
<body>
    <h1>This is my site</h1>
    <script src="scripts/app.js"></script>
</body>
</html>
// app.js
console.log('script running')

馃 Expected Behavior

The <pre>:</pre> tag ought not to render. If it does, the console.log() with error messages should fire to indicate which errors are occurring that caused the render.

馃槸 Current Behavior

The <pre>:</pre> tag is rendering every time I load a page via parcel.

This happens in both Chrome (<pre> tags render after content) and Safari (tags render before content).

馃拋 Possible Solution

I have narrowed this down to the hmr-runtime.js, but haven't done much more digging past that. I would like to know if anyone else is experiencing this error.

Bug HMR

All 3 comments

The html file you posted contains a colon in the second line, is that intentional?

Oh, wait... I feel like an absolute idiot right now that you've pointed it out! My auto-insert command for HTML starts with a :, but it looks like it wasn't removing the colon after loading the HTML5 boiler plate.

I am so sorry for wasting your time. Ooof... talk about stupid mistakes :(

No worries! 馃槃

Was this page helpful?
0 / 5 - 0 ratings