Debugging Uncaught Error: Mismatched anonymous define() module: undefined

360 Views Asked by At

I use Magento 2 and requireJs optimiser and quite often can run into below error after creating my bundles and visiting my storefront:

Uncaught Error: Mismatched anonymous define() module: undefined
https://requirejs.org/docs/errors.html#mismatch
    at makeError (require.js:5:1799)
    at N (require.js:5:8713)
    at o (require.js:5:15194)
    at Object.load (mixins.js:128:13)
    at n.<anonymous> (require.js:5:12593)
    at require.js:5:1544
    at T (require.js:5:7133)
    at n.callPlugin (require.js:5:11349)
    at n.fetch (require.js:5:9908)
    at n.check (require.js:5:11260)

I understand from other answers that this may be due to duplicate define methods or non defined modules it seems however am unsure how best to debug.

Would, for example a method like searching my code for instances of an undefined module (or even duplicate define methods) e.g. grep -ir "define() be one approach.

Would like some advice on this as quite a lot of code versions are updated by composer so not sure exactly what has changed to cause this or if i can log out of requireJs some more information than undefined here?

0

There are 0 best solutions below