milesj/packemon

Babel Error: `@babel/plugin-proposal-private-property-in-object ` explicit dependency

j3tan opened this issue · 6 comments

j3tan commented

Hitting a newly introduced error message in babel version 7.22.5 causes the following error:

--- PLACEHOLDER PACKAGE ---
This @babel/plugin-proposal-private-property-in-object version is not meant to
be imported. Something is importing
@babel/plugi-proposal-private-property-in-object without declaring it in its
dependencies (or devDependencies) in the package.json file.
Add "@babel/plugin-proposal-private-property-in-object" to your devDependencies
to work around this error. This will make this message go away.

Since packemon uses @babel/plugin-proposal-private-property-in-object for babel config, it needs to explicitly declare it as a dependency.

[resolveFromBabel('@babel/plugin-transform-private-property-in-object'), { loose: true }],

Related:
https://github.com/babel/babel-plugin-proposal-private-property-in-object
babel/babel#15687
babel/babel#15694

milesj commented

@j3tan This is a weird one. I'm not importing @babel/plugin-proposal-private-property-in-object anywhere.

But I am importing @babel/plugin-transform-private-property-in-object which is different (note transform vs proposal). There were renamed in 7.22: https://babeljs.io/blog/2023/05/26/7.22.0#renamed-packages

Maybe node modules in a weird state? Does deduping fix it?

I'll dig a bit deeper anyways.

milesj commented

I can't seem to reproduce this. Is it just being logged to the console during a build?

j3tan commented

@milesj My bad, this may be due to using an older version of packemon . I had not realized you moved away from the proposal package 2 weeks ago and we definitely haven't bumped since before that.

I'll verify and close if that is the case

j3tan commented

Some repos are still using packemon@2.x so we're using yarn resolutions to bypass the warning for now.

milesj commented

Yea this was fixed in 3.1.1. I'll leave this open for now in case there's more issues around it.