I've had a require.js app running on my drupal site for a few months now. To my knowledge, nothing has changed in the app's code, but suddenly yesterday I started getting the following error:
Uncaught Error: Mismatched anonymous define() module:
Interestingly, I got this same error even when my main.js file only included the following:
require.config({});
require([''], function() {
});
But, when I left main.js completely empty, I got the following error:
Uncaught Error: Script error for: piwik
Piwik is the first js file included at the head of the document.
I checked the Require.js documentation and found that this can be caused by loading require modules outside of the Require.js API. To test if this was the case I ran my app outside of the Drupal environment -- instead of loading the in a Drupal template I am now loading it through an external html file with the same markup as the Drupal template file. In that setup I don't receive the error and the app loads as expected.
So my question then is, are there any known conflicts with Drupal core javascript files and require.js? The only thing I can imagine causing a problem is that jquery (which is included in the document head) does a check to see if define is a function and if it is defines jquery as a module... but jquery loads before I include the require.js script.
I don't have any other scripts containing "define", "require" or "module" on the page.
I'm using the most current version of Require (2.1.8) and the latest Drupal version (7.2.3)