Next.js v13 failed to build "TypeError: e.createContext is not a function"
devinrhode2 opened this issue · 1 comments
devinrhode2 commented
search: https://github.com/Wildhoney/ReactShadow/issues?q=TypeError%3A+e.createContext+is+not+a+function
Code:
import root from 'react-shadow';
const ShadowDomRootDiv = root.div;
export const Foo = () => {
return (
<div>
demo
<ShadowDomRootDiv>shaded</ShadowDomRootDiv>
</div>
);
};
npm run build
> nextjs-demo@0.1.0 build
> rimraf .next node_modules/.cache && next build
- info Creating an optimized production build
- info Compiled successfully
- info Linting and checking validity of types
- info Collecting page data ..TypeError: e.createContext is not a function
at 7185 (/Users/drhode23/repos/bac/packages/nextjs-demo/.next/server/chunks/282.js:16257:11)
at __webpack_require__ (/Users/drhode23/repos/bac/packages/nextjs-demo/.next/server/webpack-runtime.js:25:42)
at 6669 (/Users/drhode23/repos/bac/packages/nextjs-demo/.next/server/app/page.js:592:20)
at Function.__webpack_require__ (/Users/drhode23/repos/bac/packages/nextjs-demo/.next/server/webpack-runtime.js:25:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/Users/drhode23/repos/bac/packages/nextjs-demo/node_modules/next/dist/build/utils.js:826:17)
> Build error occurred
Error: Failed to collect page data for /
at /Users/drhode23/repos/bac/packages/nextjs-demo/node_modules/next/dist/build/utils.js:1156:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
- info Collecting page data .%
devinrhode2 commented
I guess... solution is to add 'use client';
... https://stackoverflow.com/questions/74255356/typeerror-react-createcontext-is-not-a-function-nextjs-13-formik-with-typesc