Requirejs with Jquery how to use Jquery Plugins

0

I'm using requireJS to import my javascripts, however when I run the code below, it gives the following error:

Uncaught TypeError: $(...).hashchange is not a function"

(function( undefined ) {
    'use strict';


    require.config({
        baseUrl: './js',
        paths: {
            jquery: [
                'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min'
            ],
            hashchange: ["https://cdnjs.cloudflare.com/ajax/libs/jquery-hashchange/1.1/jquery.ba-hashchange"]
        },
        shim :{
            "hashchange": ["jquery"]
        }
    });
      
  
    require([ 'jquery'], function($) {
        $(window).hashchange(function() {
            //meu código
        });
    });
})();
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>

How to add jQuery plugins using requirejs?

    
asked by anonymous 24.10.2018 / 22:57

0 answers