Skip to content

Gun not working with next.js 14.0.4 #1352

@retrouser955

Description

@retrouser955

I am currently trying out Gun with next.js and I came across a problem. Next.js is throwing an error which states

./node_modules/gun/gun.js:5:16
Module not found
  3 |   /* UNBUILD */
  4 |   function USE(arg, req){
> 5 |     return req? require(arg) : arg.slice? USE[R(arg)] : function(mod, path){
    |                 ^^^^^^^^^^^^
  6 |       arg(mod = {exports: {}});
  7 |       USE[R(path)] = mod.exports;
  8 |     }

https://nextjs.org/docs/messages/module-not-found

My gun version is 0.2020.1239

Here is my code for context.

import GUN from "gun/gun"
import "gun/sea"
import "gun/axe"

export const db = GUN()

I am importing the db variable to multiple components

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions