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

Top-level await is currently not supported with the iife output format. [ESBUILD] #6

Open
andreimerfu opened this issue Feb 21, 2024 · 0 comments

Comments

@andreimerfu
Copy link

andreimerfu commented Feb 21, 2024

The example isn't working for me when I'm trying to implement it into a Rails 7.1 project with ESBUILD and Tailwind.

$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets
X [ERROR] Top-level await is currently not supported with the "iife" output format

    app/javascript/application.js:84:0:
      84 │ await window.LambdaCable.start();
         ╵ ~~~~~

Edit: I've manage to solve this by using something like this:

(async () => {
  await window.LambdaCable.start()
})();

However it's still not working.. The browser tries to make requests to the CloudFront distribution instead of the API Gateway. The action_cable.mount_path and action_cable.url are overwritten in the production.rb. Any ideas?

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

1 participant