• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

What does this mean when I try to add a JS file?

Scheduled Pinned Locked Moved NodeBB Development
3 Posts 2 Posters 1.4k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • trevorT Offline
    trevorT Offline
    trevor Plugin & Theme Dev Anime Lovers GNU/Linux
    wrote on last edited by trevor
    #1
    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?

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #2

    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 to window)

    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

    1 Reply Last reply
    1
  • trevorT Offline
    trevorT Offline
    trevor Plugin & Theme Dev Anime Lovers GNU/Linux
    wrote on last edited by
    #3

    Okay good example, I'll see if this works...

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development