lwc
lwc copied to clipboard
Async await syntax is broken on Firefox
Description
The modern async - await syntax seems broken on Firefox while using a static resource library.
Please note that if I put the same code in to a LWC, it works well, but when I put it into a static resource, it's broken.
Steps to Reproduce
- Create a simple static resource like this
const test = async () => {
console.log('hello');
};
(async () => {
await test();
console.log('This line is unreachable on Firefox');
})();
- From the LWC
import { LightningElement } from 'lwc';
import sampleLib from '@salesforce/resourceUrl/sampleLib'
import {loadScript} from 'lightning/platformResourceLoader'
export default class SampleCode extends LightningElement {
constructor(){
super();
loadScript(this, sampleLib).then(()=> {
//just do nothing
})
}
}
Expected Results
The line of code after the await should be reachable.
Actual Results
The line of code after the await is unreachable on Firefox.
Browsers Affected
Firefox
Version
The latest version - 134.0 (aarch64)
Thanks for reporting this issue! It looks like an issue with the resource loader module, not the LWC framework (this repo). To resolve your issue, I would recommend opening a Salesforce Stack Exchange question or a Salesforce case.
Thank you @wjhsf I've created a question here https://salesforce.stackexchange.com/questions/429373/async-await-syntax-is-broken-in-static-resource-on-firefox