Running fuels on NextJS

I’m trying to run an app using nextJS with fuels. When it compiles it gives the following error

SyntaxError: Named export ‘ec’ not found. The requested module ‘elliptic’ is a CommonJS module, which may not support all module.exports as named exports.

I can fix this locally by changing the import on

to
import pkg from"elliptic";

const p = pkg.ec

But this fix is not valid when building the project on vercel. Is there a workaround for this ?

4 Likes

Great question! You need to change the next config to set esmExternals to false.

experimental: {
    esmExternals: false,
 },

You can see an example here: webgum/next.config.js at main · Webgum/webgum · GitHub

This worked, thank you!

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.