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

Using async code causes build to fail with "Module not found: Can't resolve '@babel/runtime/regenerator'" #597

Open
scpmx opened this issue Aug 11, 2021 · 1 comment

Comments

@scpmx
Copy link

scpmx commented Aug 11, 2021

Is this a bug report?

Yes.

Environment

  1. node -v: v16.6.1
  2. npm -v: 7.20.5
  3. yarn --version (if you use Yarn): N/A
  4. npm ls create-elm-app -g: [email protected]

Then, specify:

  1. Operating system: Mac OS
  2. Browser and version (if relevant): Any

Steps to Reproduce

  1. create-elm-app repro-steps
  2. cd repro-steps
  3. Add some async code to the bottom of src/index.js, such as:
async function foo() {
  var s = await bar();
  console.log(s);
}

function bar() {
  return "bar";
}

Expected Behavior

elm-app start and elm-app build run as expected

Actual Behavior

Both commands fail with the following error:

Failed to compile.

./src/index.js
Module not found: Can't resolve '@babel/runtime/regenerator' in '/Users/me/Projects/repro-steps/src'
@scpmx scpmx changed the title Using async js causes build to fail with "Module not found: Can't resolve '@babel/runtime/regenerator'" Using async code causes build to fail with "Module not found: Can't resolve '@babel/runtime/regenerator'" Aug 11, 2021
@atlewee
Copy link

atlewee commented Aug 12, 2021

Observation:
If you add a package.json with browserslist in it the error seems to go away... ?
...
"author": "",
"license": "ISC",
"dependencies": {...},
"browserslist": [
"last 2 Chrome versions",
"last 2 Edge versions",
"Firefox ESR",
"last 2 Safari versions",
"last 2 iOS versions"
]
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants