-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Using-inferno: React.createContext is not a function #9021
Comments
|
With the
by changing it to this: const React = require('inferno-compat');
const createContext = require('create-react-context/lib/implementation');
for (const key in Object.keys(React)) {
if (key !== 'default' && key !== '__esModule') {
exports[key] = React[key];
}
}
// bypass export of React.createContext
exports.createContext = createContext;
exports.default = React.default; I am getting:
This is the config I am using: module.exports = {
webpack: function (config, { dev }) {
config.resolve.alias = {
...config.resolve.alias,
react: __dirname + '/src/inferno-compat.js',
'react-dom': __dirname + '/src/inferno-compat.js',
...dev && { inferno: __dirname + '/node_modules/inferno/dist/index.dev.esm.js' }
}
return config
}
} Is this alias: moduleAlias.addAlias('react-dom/server', 'inferno-server') only useful if we are using a custom server? |
@sorleone can you try the new example? (the PR)
Nope, you have to use it for SSR. We are discussing if the custom server can be removed from the example. |
By the way, I cloned your project and applied the new files. Unfortunately it won't work because MUI uses hooks and it isn't supported by Inferno. |
So next.js can't support inferno anymore? |
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. |
Bug report
Describe the bug
To Reproduce
Yarn
NPM
open the dev console of the browser and you should see the error.
Expected behavior
I expect the app to work without errors.
System information
Additional context
https://github.com/zeit/next.js/tree/canary/examples/using-inferno
https://github.com/mui-org/material-ui/tree/master/examples/nextjs
The text was updated successfully, but these errors were encountered: