Module not found: Can't resolve 'uikit' in Next.js
franklin-vidal opened this issue · comments
Hi,
using:
import { Button } from 'uikit-react'
<Button>Hello!</Button>
I got a error:
error - ./node_modules/uikit-react/lib/uikit-react.js:22:0
Module not found: Can't resolve 'uikit'
Import trace for requested module:
./pages/index.js
https://nextjs.org/docs/messages/module-not-found
error - SyntaxError: Cannot use import statement outside a module
I had a similar issue. Was able to resolve it by navigating in the node_modules/uikit-react folder and running 'npm install' there.
Not sure if thats your issue but might work.
Should uikit be moved to a dependency instead of peerDependency? I had figured people would want to pull this in themselves since the css should be added to their build tools anyway.
@vacarsu I think uikit
should remain a peer-dependency. Both yarn
and npm
spit out warnings that this lib wants uikit
, and I may implement or alias the uikit
module myself for some unique server-side rendering. In fact, that's exactly what I do with your lib and preact
.
The README could be updated to more explicitly instruct that this library is kind-of a plugin/extension/... to uikit
and that module should be installed alongside react
and react-dom
.
Those are my two cents.
I agree with @aaronhuggins closing this issue.