RequireJS "jQuery not defined"

This is a super quick and simple post... but maybe it'll save someone time down the line. I sure won't make the mistake again. I spent more time than I would like to admit figuring out this issue. There are a lot of posts sprinkled around about different causes of the error, none of which were the cause of my error.

Given the following RequireJS config:


I was trying to do the following:

require([jQuery], function ($) {

That gave me the dreaded "jQuery not defined" error!


Add quotes around "jQuery"!

require(["jQuery"], function ($) {

Without the quotes jQuery was being treated as a Javascript variable instead of a string. So when it was looking for the jQuery dependency it did not exist. "jQuery" on the other hand does.

If you have any feedback for me, I'd love to hear it - corrections, alternative paths, you name it! Send me an email