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

_index.mjs may not be resolved for some reason in legacy projects #12902

Closed
fengxinming opened this issue Feb 25, 2021 · 10 comments · Fixed by #12919
Closed

_index.mjs may not be resolved for some reason in legacy projects #12902

fengxinming opened this issue Feb 25, 2021 · 10 comments · Fixed by #12919
Labels
i: needs reproduction This report needs a reproduction repo outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@fengxinming
Copy link

fengxinming commented Feb 25, 2021

_index.mjs of @babel/runtime@7.13.x may not be resolved for some reason in legacy projects, I would like to recommend babel team to rename _index.mjs to index.es.js, Thanks!

@babel-bot
Copy link
Collaborator

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

@fengxinming fengxinming changed the title _index.mjs of @babel/runtime@7.13.x may not be resolved for some reason in legacy projects _index.mjs may not be resolved for some reason in legacy projects Feb 25, 2021
@babel-bot
Copy link
Collaborator

Hi @fengxinming! This issue is missing some important information we'll need to be able to reproduce this issue.

Please understand that we receive a high volume of issues, and there are only a limited number of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided, the more likely it is that we'll be able to help.

Please make sure you have the following information documented in this ticket:

  1. Your Babel configuration (typically from .babelrc or babel.config.js)
  2. The current (incorrect) behavior you're seeing
  3. The behavior you expect
  4. A short, self-contained example

Please provide either a link to the problem via the repl, or if the repl is insufficient, a new and minimal repository with instructions on how to build/replicate the issue.

@afc163
Copy link

afc163 commented Feb 25, 2021

#12861

@fengxinming
Copy link
Author

@afc163 I can not change webpack config for some legacy reason,I wish everything is going well like 7.12.18。

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Feb 25, 2021

#12900 shows well what is the problem.

I'm sorry that this update broke your project, but it's a problem in you webpack configuration: .mjs files work in every webpack version, except if your config tells webpack not to make them work.
I have been trying to think about a fix, but if you need this to be resolved soon you should fix it in your webpack config.

In the meantime, you could pin @babel/runtime to ~7.12.0.

@fengxinming
Copy link
Author

@nicolo-ribaudo

{
  "resolutions": {
    "@babel/runtime": "7.12.18",
    "@babel/runtime-corejs2": "7.12.18",
    "@babel/runtime-corejs3": "7.12.18"
  },
}

I have locked versions by this way, and the problem is not what you think, and webpack configuration can not be changed in our projects, for some legacy reason those configuration be wrapped like react-scripts, actually those @babel/runtime packages are from dependencies of some third party packages, our projects still use babel6.

@JLHwung
Copy link
Contributor

JLHwung commented Feb 25, 2021

The .mjs is not respected in react-scripts 0.9

https://github.com/facebook/create-react-app/blob/144f03b114f791f66a7db68ae8bc644c8c30a227/packages/react-scripts/config/webpack.config.prod.js#L124-L157

However it was fixed later in some versions between 1.0.0 and 1.0.17:

https://github.com/facebook/create-react-app/blob/4b55193f0ad479f26b0f5e153bb4b152a1ee03e7/packages/react-scripts/config/webpack.config.prod.js#L133-L182

All of the versions mentioned above are 4 years old, when Node.js 6.13 even did not exist. Babel/runtime 7.13 does not support such config, consider upgrade react-scripts to a modern version to correctly handle .mjs.

@fengxinming
Copy link
Author

@JLHwung Thank you for your suggestion that is really useful, but I did not use react-scripts in our legacy projects, my last comment means our legacy build tool kind of like react-scripts, there is not a webpack configuration file in the project. I believe the babel team will find a best way to solve it.

@nicolo-ribaudo
Copy link
Member

Can you share a repository with a similar setup that shows the bug? It's hard to reproduce it otherwise.

@JLHwung JLHwung added i: needs reproduction This report needs a reproduction repo and removed Needs Info labels Feb 26, 2021
@fengxinming
Copy link
Author

I have known the reason that _index.mjs matched the file-loader rule, I just can not directly change the webpack configuration, However thanks to @nicolo-ribaudo and @JLHwung

@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 Jun 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: needs reproduction This report needs a reproduction repo outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants