-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Odd 'loose' mode configuration must be the same... #11622
Comments
Hey @dimaqq! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
Both Are you sure you don't have another babel config (like a .babelrc file) that is enabling loose mode for class-properties? |
I don't have another config... at least not anything I've written. I've tried:
I guess I'm stuck in Would it help if I cut down my setup to a small-ish public repo? |
CRA sets class properties to loose :) |
I have the same problem with Storybook ( |
TL;DRconcise work-around: "babel": {
"presets": [
[
"@babel/preset-env",
{
"loose": true,
"shippedProposals": true
}
]
]
}, |
This is a breaking change. |
This code works with 7.9 but not with 7.10: const output = babel.transformSync("class A { x }", {
configFile: false,
presets: [[env, { shippedProposals: true }]],
plugins: [[classProperties, { loose: true }]],
}); |
@JLHwung, is this the same issue? I also don't have plugin-proposal-private-methods anywhere in package.json, so I am not sure which babel package depends on it. Here is my package.json "devDependencies": { "@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/runtime": "^7.6.3",
"babel-preset-nano-react-app": "^0.1.0",
"cssnano": "^4.1.10", "parcel-bundler": "^1.11.0",
"parcel-plugin-clean-dist": "0.0.6" },
"babel": { "presets": [ "nano-react-app" ],
"plugins": [
[ "@babel/plugin-proposal-class-properties", { "loose": true } ],
[ "@babel/plugin-transform-react-jsx", { "pragmaFrag": "React.Fragment" } ]
] Any clue what's going on here? why it works on local but not on GitLab CI? Thanks, |
Could you share your lockfile ( |
Attached is the package-lock.json @nicolo-ribaudo how do you know the two plugins have been included by the reset nano-react-app? |
Ok, I think that the problem is that Parcel is bringing in You can workaround this Babel bug (until it's fixed) by using
https://github.com/nano-react-app/babel-preset-nano-react-app/blob/master/index.js |
@nicolo-ribaudo your suggestion works. Thanks for the help! |
It seems this may have regressed between 7.10.1 and 7.10.2, seeing the same error with no change in config Error
Attempted fixesTried suggested change (setting Versions with error "@babel/core": "7.10.2"
"@babel/preset-env": "7.10.2"
"@babel/preset-typescript": "7.10.2" WorkaroundDowngrade all three packages to babel.config.jsmodule.exports = (api) => {
api.cache(true);
return {
presets: [
[
'@babel/env',
{
targets: {
browsers: 'Last 2 Chrome versions, Firefox ESR',
node: '10',
},
},
],
'@babel/preset-typescript',
],
plugins: [
'dynamic-import-node',
],
env: {
build: {
ignore: [
'**/*.test.tsx',
'**/*.test.ts',
'**/*.story.tsx',
'__snapshots__',
'__tests__',
'__stories__',
],
},
},
ignore: [
'node_modules',
],
};
}; Other notable dependenciesError occurs when trying to build |
Could you share your lockfile? |
After a lot of debugging, we found that simply adding the plugins (without options) seems to work.
We don't use the plugins directly in our app but it seems they're included in I'll try and upload the lockfile with the business-sensitive bits removed later today |
We're experiencing this failure on our Storybook build, but not our main Webpack build (and they use the same babel.config.js file). Ultimately the "fix" was deleting and recreating the yarn.lock. |
Just leaving my insight here too. Working off of @JoshRobertson's suggestion, i found all the packages that inadvertently depended on babel using In summary: |
In my case the problem was in mismatch between private fields and private methods we found that you need to manually add plugin and specify More details on this PR https://github.com/babel/babel/pull/11634/files#diff-b307be8976e67ba330a71917a3322a94R1-R4 So config will look like the next one
or for storybook main.js in my case
|
Fixes loose mode issues with Babel gatsbyjs/gatsby#24640 babel/babel#11622
I'm looking for a wait to have my project set with |
@morinted |
'loose' mode configuration must be the same for both @babel/plugin-proposal-class-properties and @babel/plugin-proposal-private-methods
I'm getting this error even though I don't use either of the proposals explicitly.
Thus, it's kinda hard for me to configure their
loose
modes 😆I think they are brought in through a preset.
My config is:
I've recently done
yarn upgrade
and this error showed up.Summary of babel versions that got upgraded in
yarn.lock
:The text was updated successfully, but these errors were encountered: