Skip to content

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

Open
@andreimerfu

Description

@andreimerfu

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions