Skip to content
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 2: Expected constructor errors when building or watching #3450

Closed
lol768 opened this issue Aug 21, 2019 · 10 comments
Closed

Parcel 2: Expected constructor errors when building or watching #3450

lol768 opened this issue Aug 21, 2019 · 10 comments

Comments

@lol768
Copy link
Contributor

lol768 commented Aug 21, 2019

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
@aarjithn
Copy link

Same issue. node 10.16 and Windows 10.

@mischnic
Copy link
Member

Could someone please provide a reproduction?

@shanehandley
Copy link

Not a reproduction, but here's a public repo which demonstrates this issue:

https://gitlab.com/shandley/minna-no-nihongo-companion/tree/parcel2

@mischnic
Copy link
Member

@shanehandley That would be fine as well, but I get this error when running yarn build:
src/activities/noActivity.ts: Missing class properties transform.

@shanehandley
Copy link

shanehandley commented 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.

@shanehandley
Copy link

shanehandley commented Sep 1, 2019

I got a little further with this by removing anything babel6 specific from my package.json and .babelrc and re-adding the babel 7 equivilent when it errored during build.

I am now seeing the issue described in #3467 I will wait for that merge.

@DeMoorJasper
Copy link
Member

@shanehandley does this error still happen with the latest parcel 2 version and babel 7 plugins?

@shanehandley
Copy link

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.

@shanehandley
Copy link

This specific issue no longer occurs for me, thank you.

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 14, 2019

Awesome, I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants