7

We are trying to setup Store in /webshop and are using RequireJs to setup the deps for each main part of the site.

When loading a page with (from what i can see) any of Store's own javascripts, forms and such 1-2 errors are thrown. I am guessing the first one has to do with the storeJs not liking that we are loading requireJs.

Uncaught ReferenceError: accounting is not defined 

Update: The error above breaks every page where Store's JS is used when i use require-jquery.js

And the other one is thrown from require.js.

Uncaught Error: Mismatched anonymous define() module: function (){return n}
http://requirejs.org/docs/errors.html#mismatch

I load a combined requirejs+jquery build (tested with a clean build) in the head of every page using js and require that pages specific .js in the footer.

The error seems to originate från line 338 in themes/third-party/store/store.js Adding an id to the define method seems to supress the warning but i cant say for effects elsewhere.

Has anyone had the same problem or know of a solution?

3
  • Hmm. Accounting should be defined in store.js, since it's a library we use. I'll have to test with require.js and see if I can replicate the issue you're describing. Nov 28 '12 at 4:04
  • I think the error with accounting triggered because of the require error and the fact that we loaded our own version of jquery? Nov 28 '12 at 11:37
  • Any updates on this issue? I'm using requirejs also and am running into the same problem.
    – Bryant
    Aug 6 '13 at 23:38
3

I had the same problem in another context, so I don't know if this will help. I had the problem using safecracker with its own JS loader. The only thing that worked for me was to load my own js (in this case jquery) and set the safecracker parameter to "no" to stop it loading its own.

As an aside, I lament the lack of a unified approach to integrating common scripts like jquery and Requirejsj. Most of my sites end up with multiple copies spread about the place between EE code, add-on codes and my own code. There must be a better way.

1
  • I have managed to get the pages working by adding an ID to the define method and using require without embedded jQuery. As @John writes, there are often problems like this when EE loads its own javascript. Nov 28 '12 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.