parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Uncaught ReferenceError after Parcel v2 build command

Open satanch opened this issue 3 years ago • 10 comments

🐛 bug report

When I'm using dev CLI command, everything is fine, but after build, I'm getting strange error.

🎛 Configuration

package.json

{
    "name": "NAME",
    "version": "1.1.0",
    "scripts": {
      "dashboard-dev": "parcel serve ./src/dashboard/index.html --dist-dir devBuildDashboard --no-source-maps",
      "dashboard-build": "parcel build ./src/dashboard/index.html --dist-dir dashboardBuild --no-source-maps --public-url ./"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "chart.js": "^3.5.0",
      "halfmoon": "^1.1.1",
      "moment": "^2.29.1",
      "vue": "^3.2.2",
      "vue-chart-3": "^0.5.7",
      "vue-router": "^4.0.11"
    },
    "devDependencies": {
      "@parcel/transformer-image": "^2.0.0-rc.0",
      "@parcel/transformer-vue": "^2.0.0-rc.0"
    },
    "alias": {
      "vue": "vue/dist/vue.esm-bundler.js",
      "vue-router": "vue-router/dist/vue-router.esm-bundler.js"
    }
  }
  

That's all.

🤔 Expected Behavior

Bundled project should work as expected. No errors when using dashboard-dev.

😯 Current Behavior

After build I'm getting this error in browser console:

index.b08aee2f.js:1 Uncaught ReferenceError: $98d500d0d1c27cdb$import$a009252d276c2773 is not defined
    at cr (index.b08aee2f.js:1)
    at pr (index.b08aee2f.js:1)
    at index.b08aee2f.js:1
    at hr (index.b08aee2f.js:1)
    at I (index.b08aee2f.js:1)
    at R (index.b08aee2f.js:1)
    at m (index.b08aee2f.js:1)
    at X (index.b08aee2f.js:1)
    at mount (index.b08aee2f.js:1)
    at Object.e.mount (index.b08aee2f.js:3)

Some piece from pretty printed JS:

cr = function(t, e) {
    if (!F(t)) {
        if (!t.nodeType)
            return k;
        t = t.innerHTML
    }
    const n = t
      , o = Oc[n];
    if (o)
        return o;
    if ("#" === t[0]) {
        const e = document.querySelector(t);
        t = e ? e.innerHTML : ""
    }
    const {code: r} = function(t, e={}) {
        return ec(t, P({}, gc, e, {
            nodeTransforms: [Sc, ...kc, ...e.nodeTransforms || []],
            directiveTransforms: P({}, Mc, e.directiveTransforms || {}),
            transformHoist: null
        }))
    }(t, P({
        hoistStatic: !0,
        onError: void 0,
        onWarn: k
    }, e))
      , i = new Function("Vue",r)($98d500d0d1c27cdb$import$a009252d276c2773);
    return i._rc = !0,
    Oc[n] = i
}

🌍 Environment

Software Version(s)
Parcel 2.0.0-rc.0
Node v14.16.1
npm/Yarn 6.14.12

satanch avatar Aug 12 '21 14:08 satanch