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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>