Having trouble getting Rollup to work outside of Vizhub

Hello! I’m working my way through Data Visualization with D3 - Full Course for Beginners 2022 on the YouTubes.

I’ve got to the part where you export the project from Vizhub and install it locally.

But I can’t get it to work! I get an error:

When I add --bundleConfigAsCjs, or if I rename the file to rollup.config.mjs, I get the same error.

I’ve tried adding “type”: “module” to package.json, but then I get a different error: ReferenceError: require is not defined in ES module scope, you can use import instead.

I thought maybe updating npm and node might help, but it didn’t seem to. I now have npm version 9.8.1 and node version 14.18.1 installed.

I can’t figure it out! Please can you help me?

Thanks for a great course :slight_smile:

Ed

Oh interesting! Maybe this is a change in the NPM ecosystem where Node or Rollup is somehow no longer supporting ES modules in rollup.config.js. Maybe try renaming it to rollup.config.mjs and see if that works?

The VizHub export is supposed to work out of the box, and it looks like the files that the VizHub export contains need to be updated accordingly. Thanks for reporting this!

Also, you may like Vite as a replacement for Rollup.

Check out this video I made that shows how to get started with Vite:

Okay cool thanks! I’ll check out Vite for now then.

Thanks :slight_smile:

Ed