Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS module not found #14

Closed
Flowrome opened this issue Dec 21, 2021 · 3 comments · Fixed by #15
Closed

NextJS module not found #14

Flowrome opened this issue Dec 21, 2021 · 3 comments · Fixed by #15

Comments

@Flowrome
Copy link

Hi

Do you have any idea why nextjs is giving me module not found with this library?

here's the error (there's nothing else really)

// _app.tsx
import { GbaProvider } from "react-gbajs"

const AppWrapper = ({ Component, pageProps }: Props) => {
  console.log(GbaProvider)
  return (
    <I18nextProvider i18n={i18n}>
      <GlobalContextProvider>
        <App {...{ Component, pageProps }}></App>
      </GlobalContextProvider>
    </I18nextProvider>
  )
}
error - ./pages/_app.tsx:17:0
Module not found: Can't resolve 'react-gbajs'
  15 | import { env } from "../infrastructure/utils/environment"
  16 | import { themes } from "../infrastructure/theme"
> 17 | import { GbaProvider } from "react-gbajs"
  18 | 
  19 | const AppWrapper = ({ Component, pageProps }: Props) => {
  20 |   console.log(GbaProvider)

I'm using NextJS 12.0.7 with typscript

Thank you for your hard work

Have a nice day

@macabeus
Copy link
Owner

macabeus commented Dec 21, 2021

I guess it's the same reason why eslint-plugin-import raises a false positive error (import-js/eslint-plugin-import#2132).

In short, I didn't include the main field in the package.json, since it's only for the browser.
NextJS is probably looking only for the main field instead of main and browser fields.

I can try to fix it by adding the main field in the package.json as a workaround, but it's a NextJS issue.

@macabeus
Copy link
Owner

Fix done.
You can use version 1.0.2 now.

If you want, you can check this repository with a workable (and dirty) example: https://github.com/macabeus/next-js-react-gba-js

@Flowrome
Copy link
Author

Thank you @macabeus you've made my life simplier :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants