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

loadPartialConfig() throws Cannot destructure property showIgnoredFiles of 'undefined' or 'null' on v7.12.0 #12194

Closed
MwumLi opened this issue Oct 16, 2020 · 7 comments · Fixed by #12198 or #12200
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@MwumLi
Copy link

MwumLi commented Oct 16, 2020

vue 项目构建报错

项目之前是好的, 但是最近构建报错, 如下:

TypeError: Cannot destructure property `showIgnoredFiles` of 'undefined' or 'null'.
TypeError: Cannot destructure property `showIgnoredFiles` of 'undefined' or 'null'
     at Function.<anonymous>  (/Users/luo/WorkSpace/company/alarm/node_modules/@babel/core/lib/config/partial.js:132:7)

经过排查, 发现是 @babel/core 最新的版本 ^7.x.x 版本中发布了不兼容的变更
根据语义话版本号的描述, ^7.x.x 版本的发布应该是兼容性功能增强, 但是因为 API 的变更导致以前直接使用 babel.loadPartialConfig() 的库会报错, 比如项目使用了 @vue/cli-plugin-babel@4.1.1, 他的实现如下
image

这一切的问题是因为 babel 并没有安装 samver 语义话版本造成, 期待对 loadPartialConfig 做一下兼容修复, 重新发布版本

@babel-bot
Copy link
Collaborator

Hey @MwumLi! 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."

@MwumLi
Copy link
Author

MwumLi commented Oct 16, 2020

为什么 github v7.12.1 上面的源码已经修复了这个问题, https://github.com/babel/babel/blob/v7.12.1/packages/babel-core/src/config/partial.js#L73-L81, 但是在 npm 上的 v7.12.1 的包上代码没有更改 😪

image

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Oct 16, 2020

I reverted the commit that introduced the regression and released it as @babel/parser@7.12.2.

@MwumLi
Copy link
Author

MwumLi commented Oct 16, 2020

@nicolo-ribaudo @babel/parser@7.12.2 When to publish to npm
image

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Oct 16, 2020

We only release updated packages, so only @babel/parser in this case (and not @babel/core showed in your screenshot).
You can use npm --depth 9999 update @babel/parser to update it.

Sorry my mistake, this isn't fixed yet. I'll prepare a PR; as a workaround you can pass {} to loadPartialConfig({}).

@MwumLi
Copy link
Author

MwumLi commented Oct 16, 2020

@nicolo-ribaudo I can't change it, because that vue/cli-plugin-babel call loadPartialConfig (), you can see the issue description above.
And, https://github.com/babel/babel/blob/v7.12.1/packages/babel-core/src/config/partial.js#L73-L81 has modifed, only not publish to npm

@JLHwung JLHwung changed the title v7.12.0 有不兼容性功能增强导致 Cannot destructure property showIgnoredFiles of 'undefined' or 'null' loadPartialConfig() throws Cannot destructure property showIgnoredFiles of 'undefined' or 'null' on v7.12.0 Oct 16, 2020
@nicolo-ribaudo
Copy link
Member

Fixed in 7.12.3!

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
4 participants