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

posts/publish_a_react_package_using_nextjs_as_a_base #164

Open
utterances-bot opened this issue Dec 13, 2024 · 3 comments
Open

posts/publish_a_react_package_using_nextjs_as_a_base #164

utterances-bot opened this issue Dec 13, 2024 · 3 comments

Comments

@utterances-bot
Copy link

How to publish a React component package, using NextJS as the compiler

Although your component library may not be making use of React Server Components and the like, it can be helpful to see how the component behaves in a NextJS context.

https://blacksheepcode.com/posts/publish_a_react_package_using_nextjs_as_a_base

Copy link

I tried your approach but when I try to import the component, following problem occurs:

Cannot find module 'an-example-react-package-built-with-nextjs-tooling' or its corresponding type declarations.

I even downloaded your package and it is the same Problem. Did it actually work in your hosting app?

Copy link

there is a typo in the package.json:

"main": "dist/export.js",

it needs to be exports.js when this is fixed everything should work fine.

@dwjohnston
Copy link
Owner

@sirPixieJerry Thanks a lot. I've fixed that now. I've also updated the post so to use the exports property in the package.json, so you don't need to import via the dist folder.

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

No branches or pull requests

3 participants