-
Notifications
You must be signed in to change notification settings - Fork 318
add createContext API in next preact confing #400
Conversation
} = require('preact-compat'); | ||
const { createContext } = require('preact-context'); | ||
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this actually be
const preact = require('preact-compat')
const {createContext} = require('preact-context')
preact.createContext = createContext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timneutkens
with that proposal, it worked normally.
@timneutkens |
packages/next-preact/package.json
Outdated
@@ -9,7 +9,8 @@ | |||
"preact-compat": "^3.17.0" | |||
}, | |||
"dependencies": { | |||
"module-alias": "2.0.6" | |||
"module-alias": "2.0.6", | |||
"preact-context": "^1.1.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please make this a peer dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I added it to peer dependency.
packages/next-preact/alias.js
Outdated
@@ -1,6 +1,6 @@ | |||
const moduleAlias = require('module-alias') | |||
|
|||
module.exports = () => { | |||
moduleAlias.addAlias('react', 'preact-compat') | |||
moduleAlias.addAlias('react', __dirname + '/preact-compat') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add .js
to the end of these? It wasn't immediately obvious to me that we had our own file named preact-compat.js
instead of the module itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, it was a bit incomprehensible.
added .js
to the end of these.
Also, please update the README to reflect adding the new package as well. |
review modification Co-Authored-By: toshi1127 <32378535+toshi1127@users.noreply.github.com>
@Timer |
fix Co-Authored-By: toshi1127 <32378535+toshi1127@users.noreply.github.com>
fix Co-Authored-By: toshi1127 <32378535+toshi1127@users.noreply.github.com>
@Timer fixed it! Please confirm. |
Awesome, thank you! |
How to start using this? |
@Timer |
looks like the changes are not in npm yet? |
Please publish this changes to NPM! :) |
Any updates on this being published? |
Still looks like the changes haven't been published to NPM yet, I've found in the meantime that I've had to either rollback nextjs to 7.0.3 with the current latest npm version or add these files manually if you plan to use it with nextjs 8. |
When is this going to be published to NPM? |
Still looks like this isn't published on NPM. Could a maintainer have a look at this? :) |
Any update on an NPM publish? |
Issues, URL
abstract
Since next.js v8.0.0 does not support the createContext API, an error occurred in the preact example.
I added createContext to
next-plugins / packages / next-preact / index.js
with reference to this example.