question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parcel 2: Expected constructor errors when building or watching

See original GitHub issue

Expected constructor errors when building or watching

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

package.json

    "babel-eslint": "10.0.1",
    "babel-preset-airbnb": "3.2.0",
    "babel-loader": "8.0.5",
    "babel-plugin-lodash": "3.3.4",
    "parcel": "2.0.0-alpha.1.1",

// ...
  "browser": "target/assets/main.js",
  "scripts": {
    "dev": "parcel watch app/assets/js/main.js",
    "build": "parcel build app/assets/js/main.js",
  }

babel.config.js

module.exports = function(api) {
  // Cache results until NODE_ENV changes
  api.cache.using(() => process.env.NODE_ENV);

  return {
    "presets": ["@babel/preset-env"],
    "plugins": ["@babel/plugin-syntax-dynamic-import", "lodash"]
  };
};

🤔 Expected Behavior

Build happens successfully

😯 Current Behavior

➜  play-app-template git:(feature/parcel) ✗ npm run build

> APP_NAME@1.0.0-SNAPSHOT build /home/adamwilliams/Documents/Projects/play-app-template
> parcel build app/assets/js/main.js

/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);
        ^

Error: Expected constructor 2.0.0-alpha.1.1:NodeFS to be registered with serializer to deserialize
    at value (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197:15)
    at memoizedFn (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:83:13)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:112:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:138:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);
        ^

Error: Expected constructor 2.0.0-alpha.1.1:NodeFS to be registered with serializer to deserialize
    at value (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197:15)
    at memoizedFn (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:83:13)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:112:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:138:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);

🔦 Context

Can’t use Parcel.

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-alpha.1.1
Node v10.15.2
npm/Yarn 6.10.3
Operating System Ubuntu 19.04

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shanehandleycommented, Dec 12, 2019

I’ve updated to latest parcel2 and am trying to build but have a lot of babel issues to work through…I’ll try to come back to this over the next few days.

1reaction
shanehandleycommented, Sep 1, 2019

Interesting - I have been using npm and the result seems to be different when using yarn - It looks like the reporter was also using npm - I will play around with this a little today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration - Parcel
The first thing to note when upgrading from Parcel 1 to Parcel 2 is that the npm package name has changed from parcel-bundler...
Read more >
Recently Active 'parceljs' Questions - Stack Overflow
I learning JavaScript, and I trying to use Parcel and separate my code with MVC architecture. I have problem with import class from...
Read more >
rollup.js
As you build more complex bundles, you'll often need more flexibility – importing modules installed with NPM, compiling code with Babel, working with...
Read more >
Parcelable - Android Developers
MloLink, Data structure class representing a Wi-Fi Multi-Link Operation (MLO) link ... class MyParcelable private constructor(`in`: Parcel) : Parcelable {
Read more >
react-hot-loader - npm
React-Hot-Loader is expected to be replaced by React Fast Refresh. ... React Native - supports Fast Refresh since 0.61. parcel 2 - supports ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found