Description
In order to be able to use top-level await
I enabled it in my webpack.config.js
file:
...
experiments: {
topLevelAwait: true
}
...
Top-level await
then works but only on android.
The moment a top-level await
is encountered on ios, the app will just crash without any further information.
Expected behavior:
Either
Top-level await
should work on ios like it does on android.
Or
A syntax error should be thrown so that I as a developer know why my app is crashing.
Ideally, top-level await
would be supported out-of-the-box without having to enable it by setting the experimental flag.
Aside from this, I'm using NativeScript with Svelte and top-level await
doesn't work on android either when used in *.svelte
modules. I'm not sure if that would be automatically solved once this feature gets better support from NativeScript or whether this is a seperate Svelte-Native-specific issue.
How to reproduce:
- Enable the experimental feature flag in
webpack.config.js
- Use the
await
keyword at the top-level of a module. - Run the app on ios platform
Env
OS: macOS 12.0.1
CPU: (8) arm64 Apple M1
Shell: /bin/zsh
node: 17.0.1
npm: 8.1.0
nativescript: 8.1.4
# android
java: 15.0.2
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found
# ios
xcode: 13.1/13A1030d
cocoapods: 1.11.2
python: 2.7.18
python3: 3.8.9
ruby: 3.0.2
platforms:
- DriverKit 21.0.1
- iOS 15.0
- macOS 12.0
- tvOS 15.0
- watchOS 8.0
Dependencies
"dependencies": {
"@nativescript-community/ui-material-bottomnavigationbar": "^6.2.2",
"@nativescript/core": "^8.1.5",
"@nativescript/theme": "^3.0.2",
"nativescript-secure-storage": "^2.6.2",
"nativescript-ui-listview": "^10.0.1",
"svelte-native-nativescript-ui": "0.9.0"
},
"devDependencies": {
"@nativescript/android": "8.1.1",
"@nativescript/ios": "8.1.0",
"@nativescript/unit-test-runner": "^2.0.2",
"@nativescript/webpack": "^5.0.0",
"@types/jasmine": "^3.10.0",
"karma": "6.3.4",
"karma-jasmine": "4.0.1",
"karma-nativescript-launcher": "0.4.0",
"karma-webpack": "5.0.0",
"svelte": "3.44.0",
"svelte-loader": "^3.0.0",
"svelte-native": "^1.0.0",
"svelte-native-preprocessor": "^1.0.0",
"svelte-preprocess": "^4.9.8",
"tslib": "^2.3.1",
"typescript": "^4.4.4"
}