question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_.mixin is not a function

See original GitHub issue

Using node and webstorm, when I start my app I get this error:

\node_modules\corejs-typeahead\dist\typeahead.bundle.js:195 _.mixin(LruCache.prototype, { ^

   TypeError: _.mixin is not a function

Has anyone else experianced this issue or know what causes it?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jony89commented, Dec 29, 2016

ok the problem (for me and probably for others as well) is that we run the code as well on the server side, for example rendering react on the server side and then serve html to the client.

since the code of jquery requires document :

function ( w ) {
    if ( !w.document ) {
        throw new Error( "jQuery requires a window with a document" );
    }
    return factory( w );
}

every function under $ is undefined, specifically $.extend and thus _.mixin is undefined

possible solutions :

  1. fetch typehead with lazy loading on client side only (can be done with split point, dynamic loading script with webpack) for react you could require this library at componentDidMount

  2. solution within the typehead library ?

0reactions
spapaseitcommented, May 4, 2018

Thank for your reply.

I’m loading the module dynamically as well, my import statement is on the attached() handler of an esNext module. I’m using Aurelia with Server Side Rendering, that’s why using a classic import {Bloodhound} from "corejs-typeahead"; thows the original error in this post.

Here’s the context in which I attempt the dynamic import.

async attached() {
        if (__aurelia__ssr__){
            return;
        }
        
        let module = await import("corejs-typeahead");
        let Bloodhound = module.Bloodhound;

     // ...
}

also I’m not sure why are you importing corejs-typeahead/dist/bloodhound rather than corejs-typeahead

Well, I was trying whether that would work, because importing corejs-typeahead gives exactly the same error: Cannot set property 'Bloodhound' of undefined, by which they mean root in the snippet of my previous comment.

But i guess you never ran into that one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mixin is not a function - Magento Stack Exchange
If you're having issues with mixin: Make sure you're using define() , not require() . That was the issue for me.
Read more >
this.mixIn is not a function - Stack Overflow
I've tried a different versions of aes.js and the problem is still showing up . this is the code : $(document).ready(function ...
Read more >
What does the error “Uncaught TypeError: mixin is not a ...
If you see the error "mixin is not a function", it should be following behind another JavaScript error such as "Unexpected identifier.".
Read more >
run generate, global mixin (... is not a function) #10024 - GitHub
Hi guys. I have made some global mixes and they work fine as long as I make run dev command. But when I...
Read more >
Magento: Magento 2.3.1 Uncaught TypeError: mixin is not a ...
JavaScript Mixins in Magento 2 - Practical Tutorial · Top 5 Excel Functions for Finance People (with end-to-end example) · Magento 2 Theme ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found