Netlify serverless function wont import this package. Leaves it as undefined

141 Views Asked by At
import Gun from 'gun'
import SEA from 'gun/sea'

Gun imports and works as expected, but SEA is set to undefined, when it should be an object

Notes:

  • SEA gets imported correctly on the client, and in my IDE. Netlify is the only side thats struggling
  • Netlify does not throw a could not resolve error
  • I'm running this on a local dev server, if that matters

Things I've tried:

  • reinstalling it
  • importing it like this: import Gun, {SEA} from 'gun'
  • Using node imports instead of ES6

All have had no effect

Please help, ty

1

There are 1 best solutions below

0
ViteOrer On

Found the solution Just needed to add this to the config toml

[functions]
external_node_modules = ["gun"]