Skip to content
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

ReferenceError: Can't find variable: mutableInstrumentations ios 10.3.1 #2457

Closed
0x30 opened this issue Oct 22, 2020 · 24 comments · Fixed by #2472 or #4900
Closed

ReferenceError: Can't find variable: mutableInstrumentations ios 10.3.1 #2457

0x30 opened this issue Oct 22, 2020 · 24 comments · Fixed by #2472 or #4900

Comments

@0x30
Copy link

0x30 commented Oct 22, 2020

Version

3.0.0

Reproduction link

https://github.com/0x30/vue-next-issues-2457

Steps to reproduce

  1. vue-cli (@vue/cli 4.5.8) create demo
  2. choose Default (Vue 3 Preview) ([Vue 3] babel, eslint)

After waiting for the installation, run it. Use ios 10.3.1 to open the device and you can see the error

截屏2020-10-22 下午3 48 55

截屏2020-10-22 下午3 49 26

What is expected?

normal operation

What is actually happening?

ReferenceError: Can't find variable: mutableInstrumentations


[Log] Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E8301 Safari/602.1 (eruda, line 27)

If it is difficult to find a specific version of the device, you can use xcode to download the ios10 version of the simulator to simulate

@edison1105
Copy link
Member

incorrect reproduction link @0x30

@0x30
Copy link
Author

0x30 commented Oct 23, 2020

may not need to provide a reproduction link.

Follow the steps below to see this problem

// @vue/cli 4.5.8
vue create demo
// choose vue 3 default
cd demo
npm run serve
// open url on ios 10 device

This is the project and recorded file

@huanggm
Copy link

huanggm commented Mar 10, 2021

It seems that the bug has not been fixed. 😢

iOS version: 10.2

Steps to reproduce

vue-cli (@vue/cli 4.5.11) create demo
choose Default (Vue 3 Preview) ([Vue 3] babel, eslint)

And I have changed vue@3.0.0 to vue@3.0.7

8D4E79A9-F1E0-4CAA-84DD-5D5E15D7140C

@huanggm
Copy link

huanggm commented Mar 12, 2021

@edison1105 @yyx990803 Can we reopen and fix this issue?

@edison1105
Copy link
Member

ping @HcySunYang

@HcySunYang HcySunYang reopened this Mar 12, 2021
@edison1105
Copy link
Member

edison1105 commented Mar 12, 2021

should change code as below?

terser({
  module: /^esm/.test(format),
  compress: {
  ecma: 2015,
    pure_getters: true
  },
+ mangle:{ safari10: true },
  safari10: true
})

@HcySunYang
Copy link
Member

I just checked the code of terser https://github.com/terser/terser/blob/master/lib/minify.js, seems yes. @edison1105 can you make a PR? That way we can provide a nightly build for @huanggm to testing.

@edison1105
Copy link
Member

I just checked the code of terser terser/terser@master/lib/minify.js, seems yes. @edison1105 can you make a PR? That way we can provide a nightly build for @huanggm to testing.

got it

@edison1105
Copy link
Member

edison1105 commented Mar 12, 2021

It seems not necessary 😆

image

@MaybeQHL
Copy link

@edison1105 Has the problem been solved?I opened it blank in iOS10 +

@edison1105
Copy link
Member

@edison1105 Has the problem been solved?I opened it blank in iOS10 +

It seems has not been fixed.

@HcySunYang
Copy link
Member

Oh sure, I made a mistake

@huanggm
Copy link

huanggm commented Mar 15, 2021

Could anyone fix this issue? I desire to do something. But I don't have a clue.

@duncanmcclean
Copy link

I'm in the same boat, anyone found a fix for this?

@onemantooo
Copy link

Is there any workaround for this? Got same problem.

@onemantooo
Copy link

onemantooo commented Oct 21, 2021

Had same problem

VM256:815 ReferenceError: Can't find variable: mutableInstrumentations

Tried to fix with chainWebpack:

    chainWebpack: (config) => {
      config.optimization.minimizer("terser").tap((args) => {
        const { terserOptions } = args[0];
        terserOptions.safari10 = true;

        console.log(terserOptions);
        return args;
      });
    },

not worked. console.log shows this for terserOptions:

{
  compress: {
    arrows: false,
    collapse_vars: false,
    comparisons: false,
    computed_props: false,
    hoist_funs: false,
    hoist_props: false,
    hoist_vars: false,
    inline: false,
    loops: false,
    negate_iife: false,
    properties: false,
    reduce_funcs: false,
    reduce_vars: false,
    switches: false,
    toplevel: false,
    typeofs: false,
    booleans: true,
    if_return: true,
    sequences: true,
    unused: true,
    conditionals: true,
    dead_code: true,
    evaluate: true
  },
  mangle: { safari10: true },
  safari10: true
}
"vue": "^3.2.6",

@onemantooo
Copy link

BTW Looks like code from !*** ./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js ***!
isn't minified at all, so i'm not sure this is about Terser.

@HcySunYang

@descire
Copy link
Contributor

descire commented Nov 4, 2021

use babel handle vue3 source to ES5,can solve the above problems:

// vue.config.js
module.exports = {
	transpileDependencies: [/@vue\/*/],
	...
}

but in ios10.x create blank html,because Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'

the browser threw an exception TypeError "arguments","callee" and "caller" cannot be accessed in strict mode

i make a PR can fixed #4900 @edison1105 @huanggm @HcySunYang

@zt50tz
Copy link

zt50tz commented Nov 4, 2021

Thank you for solution!

But, now i get error Can't find variable: compileCache ;(
If i set window.compileCache = {}; everything is fine, but i see it as dirty hack.

Screenshot 2021-11-04 at 16 16 10

@ghost
Copy link

ghost commented Dec 21, 2021

官方尽快解决这个问题啊,搁置了两个月了

@Jimin0810
Copy link

官方尽快解决这个问题啊,这个问题仍然未解决。我尝试了以上的所有方法

@johnbian
Copy link

you need change .env file. NODE_ENV = production.

@Jimin0810
Copy link

you need change .env file. NODE_ENV = production.

yeah, Environmental issues have been identified。thank u

@yyx990803
Copy link
Member

yyx990803 commented May 10, 2022

For Vue CLI users, make sure to transpile Vue itself if you intend to support iOS 10 (see #2457 (comment))

The remaining runtime error should be fixed after #4900 is released in the next patch. I don't have an iOS 10 device to test so please report under this thread if anyone gets it working.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.