• We all know NodeBB plugin is such a pain in the ass, because we do not have type information and we aren't sure about the hooked data structure and made unintended modification and can even unexpectedly corrupt the database. We should move on to use TypeScript, with the added benefit of being able to use ES modules that will make it able to start much faster (since ES modules are static and CommonJS are dynamic, this decreases pressure on module resolution)

  • GNU/Linux Admin

    @stevefan1999-personal This is probably somewhat of an eventuality, I think.

    I don't have much experience with TypeScript, but I know that there are some developers (@PitaJ in particular) who are already writing plugins in TypeScript.

    There are a couple of larger tech debt projects to take care of first, but this is definitely already on our medium-term roadmap.

  • GNU/Linux Admin

    I'm not entirely certain about ESM support; if only because migrating from commonjs to ESM is often an all-or-nothing approach.

    IIRC once you are in ESM-land, you can easily import other ES modules, and you can import commonJS modules, but your own exports cannot be imported by commonJS files.

    That causes a significant issue in that many plugins (still written in CommonJS) will try to require ESM-ified libraries in NodeBB and promptly crash.

    While I am reasonably certain there is a way forward (via some sort of shim, etc.), that might require the talents of people smarter than me (like @baris, @pitaj, or @oplik0 😄 )

Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.