---
schema_version: "1"
id: 18ddc737f3b4abb2c6c7bad113ad3de2d99727a6311a97c5b7bec11526bfa195
title: Static Resources with async Functions Behave Inconsistently
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lwc/lightning-components-security/guides/lws/lws-async.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-async.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e04b8837eec62b7d8301e76e9c958863162e508a8889b4aa2171eb041f90bf4a
products:
  - Security for Lightning Components
  - lwc
---
# Static Resources with async Functions Behave Inconsistently

When you use `lightning/platformResourceLoader` in Lightning web components (LWC) to access static resources and Lightning Web Security (LWS) is enabled, it’s possible that some APIs in those static resources exhibit inconsistent behavior among various browsers.

When LWS is enabled, JavaScript `async` functions that are used from a static resource work in Chromium-based browsers, but don’t work in Firefox currently. The issue is a [bug in Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1663090).

You can get around this issue in Firefox by pre-compiling the code that’s in the static resource so the `async` function is replaced by equivalent code.

This Babel plugin is recommended if you’re having issues with `async` functions in static resources: [https://babeljs.io/docs/en/babel-plugin-transform-async-to-generator](https://babeljs.io/docs/en/babel-plugin-transform-async-to-generator)

Alternatively, you can refactor to use another approach, such as JavaScript promises.

**See Also**

- [YouTube Video: Understanding Asynchronous JavaScript](https://www.youtube.com/watch?v=ytL4NXW_CGY)
