You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to run yarn dev the example breaks with the error:
$ node server.js
/home/rafael/projects/next.js/examples/using-preact/node_modules/next/dist/next-server/lib/amp-context.js:11
exports.AmpStateContext = React.createContext({});
^
TypeError: React.createContext is not a function
at Object.<anonymous> (/home/rafael/projects/next.js/examples/using-preact/node_modules/next/dist/next-server/lib/amp-context.js:11:33)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/rafael/projects/next.js/examples/using-preact/node_modules/next/dist/next-server/lib/head.js:8:23)
at Module._compile (internal/modules/cjs/loader.js:776:30)
error Command failed with exit code 1.
To Reproduce
Go to examples/using-preact
Run yarn install && yarn dev
See error
Expected behavior
The app should start successfully
System information
OS: Ubuntu 19.04
Version of Next.js: 9.1.1
Additional context
createContext is already built-in on the latest version of Preact (Preact X), it could be as simple as updating it, but then comes the second problem: you cannot run yarn build without react and react-dom installed in the project:
$ next build
The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install --save react'
The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install --save react-dom'
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'react'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/rafael/projects/next.js/examples/using-preact/node_modules/next/dist/bin/next:29:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
error Command failed with exit code 1.
Does the project need to have react and react-dom installed to be built, even if it is already using Preact, or is there a way to alias these modules to the build step like we do in next.config.js?
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 31, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Examples bug report
Example name
using-preact
Describe the bug
When trying to run
yarn dev
the example breaks with the error:To Reproduce
examples/using-preact
yarn install && yarn dev
Expected behavior
The app should start successfully
System information
Additional context
createContext
is already built-in on the latest version of Preact (Preact X), it could be as simple as updating it, but then comes the second problem: you cannot runyarn build
withoutreact
andreact-dom
installed in the project:Does the project need to have
react
andreact-dom
installed to be built, even if it is already using Preact, or is there a way to alias these modules to the build step like we do innext.config.js
?The text was updated successfully, but these errors were encountered: