Next.js Discord

Discord Forum

Help setting up with Neutralino

Unanswered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
Hey, I've seen some ppl mention NeutralinoJS here from a few years back but no real help on how to use it with NextJS. I'm trying to get the auth-info.json to be loaded in my _app.tsx (using pages structure btw) but I can't figure out how to do that...
It is being generated in project/.tmp/auth-info.json and Next app resides in project/next/src/pages/_app.tsx.
I tried doing something similar to the [vite-vue](https://github.com/FeedTheMEe/neutralinojs-vite-vue-ts-template) template which simply created a symlink from the src directory but that didn't work neither...

Any help would be appreciated

Module not found: Can't resolve '../auth_info.json'

// _app.tsx
import type { AppProps } from "next/app"
import { useEffect } from "react"

export default function MyApp({ Component, pageProps }: AppProps) {
  useEffect(() => {
    console.log("importing lib...")
    import("@neutralinojs/lib").then(async (Neutralino) => {
      if (!window.NL_PORT) {
        const nlAuthConfig = await import("../auth_info.json")
        window.NL_PORT = nlAuthConfig.nlPort
        window.NL_TOKEN = nlAuthConfig.nlToken
      }

      Neutralino.init()
    })
  })

  return <Component {...pageProps} />
}

1 Reply