3

I'm getting an error in the console and it says:

Uncaught ReferenceError: config is not defined.

The file it relates to is requirejs-config.js:1149 but I have no idea what this relates to or how to fix it. Any ideas?

The code in question is:

})(require);
require.config(config);
})();
1
  • You post anly part of code. It's not valid java script code.
    – KAndy
    Aug 9, 2016 at 16:24

1 Answer 1

11

You probably have a requirejs-config.js file somewhere in your codebase that is empty. Magento includes every requirejs-config.js file it finds, but it does expect it to contain a config object.

In terminal, in your Magento root, run;

find . -type f -iname requirejs-config.js | xargs ls -1lathr

Look for files that are 0 bytes. Either remove those files or place an empty config object in it;

var config = {};

That should fix it.

3
  • I commented the complete content of a requirejs-config.js file. Has same effect as an empty file... Your hint helped me out, thx! Jan 12, 2018 at 15:33
  • Right on the money! Jul 18, 2019 at 13:07
  • I own you a beer! :D
    – Nikolas
    Sep 15, 2023 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.