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
nodebb-plugin-category-info/static/js/lib/main.js at master · psychobunny/nodebb-plugin-category-info
This NodeBB plugin adds latest post information to each category block on the home page. Utilizes masonry to stack category blocks neatly. - nodebb-plugin-category-info/static/js/lib/main.js at master · psychobunny/nodebb-plugin-category-info
GitHub (github.com)
-
Okay good example, I'll see if this works...
Copyright © 2024 NodeBB | Contributors