1

I am trying to load papa parse min js file using requirejs but I am getting:

ReferenceError: Papa is not defined

I had checked Net section in console and it is displaying that papa parse min js loaded but it is not working in my website.

Am I doing anything wrong?

numediaweb
  • 16,362
  • 12
  • 74
  • 110
girish92
  • 29
  • 2

1 Answers1

1

Use shim like this:

require.config({
    paths: {
        'papaparse': '//cdnjs.cloudflare.com/ajax/libs/PapaParse/4.3.6/papaparse.min'
    },
    shim: {
        'papaparse': {exports: 'Papa'}
    }
});

and then use it in your module like this:

define('mymodule', ['papaparse'], function (Papa) { ... }
numediaweb
  • 16,362
  • 12
  • 74
  • 110