Expected constructor errors when building or watching
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"]
};
};
Build happens successfully
โ play-app-template git:(feature/parcel) โ npm run build
> [email protected] 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`);
Can't use Parcel.
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 2.0.0-alpha.1.1
| Node | v10.15.2
| npm/Yarn | 6.10.3
| Operating System | Ubuntu 19.04
Same issue. node 10.16 and Windows 10.
Could someone please provide a reproduction?
Not a reproduction, but here's a public repo which demonstrates this issue:
https://gitlab.com/shandley/minna-no-nihongo-companion/tree/parcel2
@shanehandley That would be fine as well, but I get this error when running yarn build:
src/activities/noActivity.ts: Missing class properties transform.
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.
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.
@shanehandley does this error still happen with the latest parcel 2 version and babel 7 plugins?
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.
This specific issue no longer occurs for me, thank you.
Awesome, I'll close this issue