-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Nuxt 3 not working on iOS <= 12 #19328
Comments
To clarify, we are talking about It can make sense to precisely track the library/feature that is causing the failure, although it must be noted that we are talking about 8-years-ago internet, and it might not be worth changing them. P.s. Note also that Vue 3 requires ES2015, i.e. iOS 10.x+ |
I really do not know where you found this information, but it simply is not true. iOS 12 (as mentioned above) was released in September 2018 and of course, it is still relevant. |
I apologize if the message was received badly, I didn't want to say that it's not relevant in any way! |
Alright. Now I've got your point. Well, I don't think that we can expect our website users to update their devices to a version, on which Nuxt 3 runs … |
As noted in #12577 (comment), please follow along the issues for the vite legacy plugin. Consolidating there 👍 PS - from the vite docs:
|
@manniL Please read my issue once more, but carefully. It has nothing to do with vite and it has nothing todo with desktop safari. Please reopen! |
I never referred to Desktop safari here. But what you want is support for older browser versions (=legacy) that are not able to understand constructs like optional chaining or nullish coalescing.
Not "directly" but somewhere you have to set up the level of transpilation (=target) - usually in an extra config or via bundler 😋 One more thing you can try is setting vite's build target to es2015 via:
|
Quickly ran the above mentioned config over a default nuxt setup and it should work fine 👍 Be aware though: You might want to add 3rd party libraries to |
@manniL Thanks a lot for checking again! Wow, this is great. I will use the following solution according to https://esbuild.github.io/api/#target and https://esbuild.github.io/content-types/#javascript vite: {
build: {
target: ["esnext", "ios12"],
},
}, What do you mean by
? |
@manniL Oh, you mean, that it could be that 3rd party libs don’t support ios12, because they use modern syntax? |
I am not entirely sure but I think yes, this is a possible scenario. |
This is great to hear. Some portable devices use NetFront, which is stuck on ES5 👀 |
Ar ok, unfortunately it is not possible to build for [vite:esbuild-transpile] Transform failed with 9 errors:
_nuxt/app.config.!~{005}~.js:6:47: ERROR: Transforming default arguments to the configured target environment ("es5" + 2 overrides) is not supported yet Transforming default arguments to the configured target environment ("es5" + 2 overrides) is not supported yet
4 | return value !== null && typeof value === "object";
5 | }
6 | function _defu(baseObject, defaults, namespace = ".", merger) {
| ^
7 | if (!isObject(defaults)) {
8 | return _defu(baseObject, {}, namespace, merger);
Transforming const to the configured target environment ("es5" + 2 overrides) is not supported yet
8 | return _defu(baseObject, {}, namespace, merger);
9 | }
10 | const object = Object.assign({}, defaults);
| ^
11 | for (const key in baseObject) {
12 | if (key === "__proto__" || key === "constructor") {
Transforming const to the configured target environment ("es5" + 2 overrides) is not supported yet
9 | }
10 | const object = Object.assign({}, defaults);
11 | for (const key in baseObject) {
| ^
12 | if (key === "__proto__" || key === "constructor") {
13 | continue;
Transforming const to the configured target environment ("es5" + 2 overrides) is not supported yet
13 | continue;
14 | }
15 | const value = baseObject[key];
| ^
16 | if (value === null || value === void 0) {
17 | continue;
Transforming array spread to the configured target environment ("es5" + 2 overrides) is not supported yet
21 | }
22 | if (Array.isArray(value) && Array.isArray(object[key])) {
23 | object[key] = [...value, ...object[key]];
| ^
24 | } else if (isObject(value) && isObject(object[key])) {
25 | object[key] = _defu(
Transforming array spread to the configured target environment ("es5" + 2 overrides) is not supported yet
21 | }
22 | if (Array.isArray(value) && Array.isArray(object[key])) {
23 | object[key] = [...value, ...object[key]];
| ^
24 | } else if (isObject(value) && isObject(object[key])) {
25 | object[key] = _defu(
Transforming rest arguments to the configured target environment ("es5" + 2 overrides) is not supported yet
36 | }
37 | function createDefu(merger) {
38 | return (...arguments_) => (
| ^
39 | // eslint-disable-next-line unicorn/no-array-reduce
40 | arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
Transforming const to the configured target environment ("es5" + 2 overrides) is not supported yet
40 | arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
41 | );
42 | }
| ^
43 | const defuFn = createDefu((object, key, currentValue) => {
| ^
44 | if (typeof object[key] !== "undefined" && typeof currentValue === "function") {
Transforming const to the configured target environment ("es5" + 2 overrides) is not supported yet
51 | return useNuxtApp()._useHead(input, options);
52 | }
53 |
| ^
54 | const inlineConfig = {};
| ^
55 | |
@ckhatton ES5 has no proxy support (they came with ES2015, which is ES6), so it won't support Vue3 and Nuxt3 |
Have you solved your problem? now i use nuxt3.1.2 in ios12 and i set
It still reports an error like this |
I'm using this in my nuxt.config.js
The default value of vite.build.target is safari14 which require atleast iOS 14, change it to safari12 makes my app able to run on iOS 12. @vitejs/plugin-legacy also works (#20087) but it will increase the javascript file size by atleast 1MB and it will introduce |
After i setup safari12, got this error
Is there any other solution? |
This comment was marked as duplicate.
This comment was marked as duplicate.
@lww555 (How) Did you solve this issue? In a new app I am also getting this error with |
how to resolve globalThis in safari 11 with nuxt 3 please |
Hi, I resolved an issue using the following approach. You may check an example of my So, you may add as many polyfills as required by your concrete case. In dev tools (console) you will see errors. Most likely, they could be solved by polyfills. Pay attention, that your polyfill must be loaded before nuxt/vue application is bootstrapped. Also, it should be run on browser (not on your server) Good luck :)
|
简单说一下我的测试结果: // nuxt.config.js
export default defineNuxtConfig({
vite: {
target: ['es2015', 'ios12', 'chrome87', 'safari12']
}
}) 设置之后,打包之后的项目,运行正常。我没有遇见 |
I also had problems with |
Environment
Darwin
v14.20.1
3.2.2
2.2.3
pnpm@7.28.0
vite
-
-
-
Reproduction
Created a minimal reproduction on stackblitz, while the problem is, that stackblitz (and codesandbox) does not work on iOS (12). So I hope this is not a problem!
But basically all you need to do is installing Nuxt 3 and open the page with an iOS device on iOS 12 or below.
In the stackblitz example above, I’ve created this simple counter app, to demonstrate, that no interaction works (on iOS <=12):
But the same error occurs, when you stay with the default app.vue (
<NuxtWelcome />
).Describe the bug
First: I think this is the same bug as described here, but somehow the issue was closed.
No, not vite: I’ve tested it, and it has nothing to do with vite as builder, because I’ve tested it also with webpack as builder and you can verify this too by trying it with webpack. And if you have a look at can i use (es6-module, dynamic-import, import.meta), vite is supported on iOS 12.
Here is a video of the app running on an iPad with iOS 12 (via browserstack.com):
bug.mp4
As you can see, the problem is that an error is thrown, that stops the app from working (both vite and webpack):
Safari on iOS 12 (from 2018/19) is still a relevant browser with
0.42%
, as you can see on usage tables. So I hope we can fix this!The text was updated successfully, but these errors were encountered: