What does this mean when I try to add a JS file?
-
Uncaught Error: Mismatched anonymous define() module: function ($){return factory($);} http://requirejs.org/docs/errors.html#mismatch
It seems I can't add anything with a define()
EDIT: I found another approach but for future references, can someone still explain this to me?
-
Some JS files have built-in AMD support, ie. support for requirejs. If it detects requirejs the script will attempt to
define()
itself (as opposed to attach itself towindow
)So in other words, don't add this script to your header, you should use requirejs to load it, like this
https://github.com/psychobunny/nodebb-plugin-category-info/blob/master/static/js/lib/main.js
-
Okay good example, I'll see if this works...
Copyright © 2024 NodeBB | Contributors