Fork me on GitHub

Just released another version of nbb with some bug fixes. Nbb's birthday is coming up at the end of the month - will it reach 500 stars or not by then...?

❤️ 3
Michaël Salihi13:07:00

Let's say, I want to run serverless function (DigitalOcean functions) accepting only CommonJS with a main function. For now, I have a working solution with this wrapper hello.cjs:

async function main(params) {
  const { handler } = await import('./hello.mjs');
  return handler(params);

exports.main = main;
Any kind of suggestion or better way to run nbb?


So hello.cjs loads hello.mjs which loads nbb?


Cool workaround :)

😁 1

One other option is to put it through webpack which is able to bundle your entire thing into a .cjs file, including nbb.


But I think your workaround is great and should maybe be documented somewhere in nbb's repo

Michaël Salihi14:07:54

Thanks. 🙂 I saw this happen when you added the version of nbb with bundle. Will try.


> I saw this happen what did you see happen?

Michaël Salihi14:07:48

Yes, that's what I intended (to document this). Precisely, I wanted a confirmation before doing the PR so perfect 🙂

Michaël Salihi14:07:09

> what did you see happen? Badly expressed sorry. I saw the doc about bundle + webpack that you linked.