Attempted import error: 'Context' is not exported from 'theme-ui' (imported as 'u').
console error :
yarn run v1.22.5
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - ./node_modules/essential-slices/dist/index.module.js
Attempted import error: 'Context' is not exported from 'theme-ui' (imported as 'u').
event - build page: /next/dist/pages/_error
wait - compiling...
error - ./node_modules/essential-slices/dist/index.module.js
Attempted import error: 'Context' is not exported from 'theme-ui' (imported as 'u').
Dev: local
Error: Cannot find module '/home/ilhamsa1/demo/test-prismic-next/.next/build-manifest.json'
Require stack:
Uninstalling 'essential slices' and removing it's refs in the code brings me to where to the same place as following the solutions in the github issue.
It keeps spitting out this for a bunch of packages There are multiple modules with names that only differ in casing.
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
I just tried this prismic theme and it no longer reproduces the error for me, however, I am having problems with the Slice Machine UI. When I make a modification to a slice that I created via the CLI with --create-slice. The error message is from 0.0.45 for slice-machine-ui. It breaks when I try to save it to the file system, but also when I modify the model manually and try to push the slice to Prismic.
I have only one slice. I try to make any modification to slice adding a new field but I receive this error (and I am using the example @Phil provided):
[slice-machine] (node:55327) UnhandledPromiseRejectionWarning: TypeError: content.flat is not a function
at createMockFromConfig (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/widgets/StructuredText/mock.js:46:18)
at handleMockConfig (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/widgets/StructuredText/mock.js:61:19)
at handleFieldMock (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/mock.js:25:12)
at reduce (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/mock.js:37:20)
at Array.reduce (<anonymous>)
at handleFields (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/mock.js:32:17)
at map (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/mock.js:63:20)
at Array.map (<anonymous>)
at _callee$ (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/slice-machine-ui/lib/mock.js:61:39)
at tryCatch (/Users/jameshome/Documents/projects/nextjs-prismic-wecraft/node_modules/regenerator-runtime/runtime.js:63:40)
[slice-machine] (node:55327) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:55327) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@luke_h I am wondering you get that error from just running yarn dev ? I had no issues until I used the Slice Machine UI and I did not see your error (yet).
OK, that makes sense. To use Slice Machine you will need to have at least version 12.16.1 of node installed on your machine. This is posted on many parts of the documentation.