Skip to content

n0v1/parcel-scope-hoisting-bug

Repository files navigation

For debugging Parcel --experimental-scope-hoisting bug with svg inline import in vue component

How to replicate

  • Install dependencies by running npm install.
  • npm run prod:nomin:hoist, then visit http://127.0.0.1:4321: no console errors, icon is displayed
  • npm run prod:hoist, then visit http://127.0.0.1:4321: errors in console and no icon displayed

Error message:

js.07725bad.js:formatted:709 ReferenceError: $rLiX$$interop$default is not defined
    at i.data (js.07725bad.js:formatted:3565)
    at Ad (js.07725bad.js:formatted:1903)
    at zd (js.07725bad.js:formatted:1891)
    at xd (js.07725bad.js:formatted:1869)
    at i.Ld.e._init (js.07725bad.js:formatted:2012)
    at new i (js.07725bad.js:formatted:2084)
    at je (js.07725bad.js:formatted:1264)
    at init (js.07725bad.js:formatted:1202)
    at js.07725bad.js:formatted:2455
    at o (js.07725bad.js:formatted:2473)

The minified source contains this:

var tf = {};
tf = "<svg width=\"24\" height=\"24\"><path d=\"M20 8h-2.81a5.985 5.985 0 0 0-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z\"/></svg>";
var Qg = zg(tf);
var ea = {
    name: "SvgIcon",
    data: ()=>({
        svg: $rLiX$$interop$default.d
    })
};

See SvgIcon component.

For reference, the non-minified source (npm run prod:nomin:hoist) looks like this:

// ASSET: ../node_modules/material-design-icons/action/svg/production/ic_bug_report_24px.svg
var $rLiX$exports = {};
$rLiX$exports = '<svg width="24" height="24"><path d="M20 8h-2.81a5.985 5.985 0 0 0-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/></svg>';
var $SCM$export$default = {
  name: 'SvgIcon',

  data() {
    var $rLiX$$interop$default = $parcel$interopDefault($rLiX$exports);
    return {
      svg: $rLiX$$interop$default.d
    };
  }

};

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published