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

Bug: Build error - top level await #25

Closed
1 of 2 tasks
bdougie opened this issue Apr 21, 2023 · 3 comments · Fixed by #26
Closed
1 of 2 tasks

Bug: Build error - top level await #25

bdougie opened this issue Apr 21, 2023 · 3 comments · Fixed by #26
Labels

Comments

@bdougie
Copy link
Member

bdougie commented Apr 21, 2023

Describe the bug

vite v2.9.15 building for production...
✓ 51 modules transformed.
rendering chunks (2)...[vite:esbuild-transpile] Transform failed with 1 error:
assets/profileScreen.ts.af6d3823.js:167:25: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
165|  const username = getGithubUsername(window.location.href);
166|  if (username != null) {
167|    const openSaucedUser = await getOpenSaucedUser(username);
   |                           ^
168|    if (openSaucedUser)
169|      injectViewOnOpenSaucedButton(username);

error during build:
Error: Transform failed with 1 error:
assets/profileScreen.ts.af6d3823.js:167:25: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
    at failureErrorWithLog (/Users/bdougie/code/browser-extensions/node_modules/esbuild/lib/main.js:1624:15)
    at /Users/bdougie/code/browser-extensions/node_modules/esbuild/lib/main.js:1413:29
    at /Users/bdougie/code/browser-extensions/node_modules/esbuild/lib/main.js:678:9
    at handleIncomingPacket (/Users/bdougie/code/browser-extensions/node_modules/esbuild/lib/main.js:775:9)
    at Socket.readFromStdout (/Users/bdougie/code/browser-extensions/node_modules/esbuild/lib/main.js:644:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Steps to reproduce

A new build error was introduced in the last merge.

Affected services

opensauced.pizza

Platforms

No response

Browsers

No response

Environment

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@bdougie bdougie added the 🐛 bug Something isn't working label Apr 21, 2023
@Anush008
Copy link
Member

Anush008 commented Apr 21, 2023

@bdougie, It does seem the build process fails due to top-level awaits. Even with ESNext in the tsconfig. I'll wrap it in an async() to resolve this.
Edit: Turns out that ESNext has to be set as the build target in the vite.config.ts file too.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants