Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8312567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:12:32+00:00 2026-06-08T20:12:32+00:00

I am learning about require.js and think I am just missing something. I don’t

  • 0

I am learning about require.js and think I am just missing something. I don’t understand how it loads files.

I have my jquery file in a lib directory.

This does not work:

It shows that jquery is being loaded in the chrome network panel. Error is: Uncaught TypeError: undefined is not a function . so it is basically saying that $ is undefined.

require(['lib/jquery'],function($) {
  $(document).ready(function(){
    alert('hello');
  });
});

This works:

require.config({
    paths: {
        jquery: 'lib/jquery'
    }
});


require(['jquery'],function($) {
      $(document).ready(function(){
      alert('hello');
    });

});

In other examples I see online you don’t have to set the paths with require.config. Do I have to do this every time that I want to define a module? I know I am using require and not define in this case, but I am having the same issue with the define method. Every time I make a module using define I have to set the paths using require.config(). I think I am missing something here. Can anyone point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:12:33+00:00Added an answer on June 8, 2026 at 8:12 pm

    Update to reflect comments and James’ answer:

    You have two problems:

    1. jQuery, for the reasons James outlines in his answer, requires that you either have paths set in your config, or that you, in the code you’ve outlined, set baseUrl to “lib”.

    2. you have to remember that you can’t just load any old script with RequireJS. Only scripts that conform to the AMD standard can be loaded.

    Having said this, I’d advice you use require-jquery instead.

    You’ll probably end up using jQuery plugins that will assume jQuery is loaded on the page, and those won’t work with the approach you’re trying.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning about ORM's, and am wondering... if you have an object (a
I'm just learning about C and got an assignment where we have to translate
Learning about notifyAll made me question something about notify: in a typical situation we
I have been learning about Delegation and Data Sources for iOS programming and need
I'm learning about hash tables, trying to understand how they work. I'd like to
I am just learning rails. I like so much about Rails. It utterly destroys
I've been learning Ruby, just for fun so far (no current projects require Ruby).
Total noob here learning openGL and I don't have any code to post because
After learning about the Action delegate in C# I've been looking for ways I
I am learning about raw sockets. I heard that ping utility is using raw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.