Skip to content

Uncaught TypeError: slots[name$1].every is not a function #10839

Closed
@marfrelen

Description

@marfrelen

Version

2.6.10

Reproduction link

https://stackoverflow.com/questions/56390672/vue-js-slotsname1-every-is-not-a-function

Steps to reproduce

I created a new Laravel Project with a couple of single file vue Components.
My app.js looks like this:

if(typeof Object.prototype.clone !== 'undefined'){
    Object.prototype.clone = function() {return JSON.parse(JSON.stringify(this));}
}

import test from "./components/test";
Vue.component('vue-test', test);

new Vue({
    el: '#app',
});

I build my compiled app.js file with Laravel.mix.

What is expected?

Something like this:

let foo = {test: 'foo'};
const bar = foo.clone();
bar.test = 'bar';

console.log(foo, bar);

{test: foo}, {test: bar}

What is actually happening?

Vue throws the following error:

Uncaught TypeError: slots[name$1].every is not a function
    at resolveSlots (app.js:82705)
    at initRender (app.js:83658)
    at VueComponent.Vue._init (app.js:85164)
    at new VueComponent (app.js:85314)
    at createComponentInstanceForVnode (app.js:83463)
    at init (app.js:83294)
    at createComponent (app.js:86140)
    at createElm (app.js:86087)
    at createChildren (app.js:86215)
    at createElm (app.js:86116)

If I remove the Object.prototype function, everything works fine.
But in the case I extended the Object.prototype object, I'll get the error above.


I hope my infomation helps you to reproduce this error.
If you need some deeper information, leave me a message at markus.lenz@ort-online.net.

Thanks and kind regards,
Markus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions