Anonymous define() function can break require.js JS apps

Created on 8 January 2015, over 9 years ago
Updated 19 September 2023, 9 months ago

I have a requirejs based javascript app that's loaded inside of my Drupal site. In FF and Safari (but not Chrome), I'd get the following error:

Mismatched anonymous define() module: function () { "use strict"; return d; } http://requirejs.org/docs/errors.html#mismatch

It turned out to be the use of define in picturefill.js:

 if ( typeof define === "function" && define.amd ){
    // AMD support
    define( function() { return picturefill; } );
  }

This anonymous call to define() didn't play well with require.js, and in my case, it broke picture.js which was looking for a global object.

πŸ› Bug report
Status

Closed: works as designed

Version

2.8

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands aquariumtap

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024