Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

chore: Upgrade Preact #544

Merged
merged 3 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/next-preact/alias.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path')
const moduleAlias = require('module-alias')

module.exports = () => {
moduleAlias.addAlias('react', path.join(__dirname, './preact-compat.js'))
moduleAlias.addAlias('react-dom', 'preact-compat')
moduleAlias.addAlias('react', 'preact/compat')
moduleAlias.addAlias('react-dom', 'preact/compat')
moduleAlias.addAlias('react-ssr-prepass', 'preact-ssr-prepass')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my other comment, I'd prefer preact-ssr-prepass be a dependency of this plugin rather than being left up to userland.

Suggested change
moduleAlias.addAlias('react-ssr-prepass', 'preact-ssr-prepass')
moduleAlias.addAlias('react-ssr-prepass', require.resolve('preact-ssr-prepass'))

}
10 changes: 4 additions & 6 deletions packages/next-preact/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const path = require('path')

module.exports = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
Expand All @@ -14,10 +12,10 @@ module.exports = (nextConfig = {}) => {
}

config.resolve.alias = Object.assign({}, config.resolve.alias, {
react$: path.join(__dirname, './preact-compat.js'),
'react-dom$': 'preact-compat',
react: path.join(__dirname, './preact-compat.js'),
'react-dom': 'preact-compat'
react$: 'preact/compat',
'react-dom$': 'preact/compat',
react: 'preact/compat',
'react-dom': 'preact/compat'
})

if (typeof nextConfig.webpack === 'function') {
Expand Down
4 changes: 1 addition & 3 deletions packages/next-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"license": "MIT",
"repository": "zeit/next-plugins",
"peerDependencies": {
"preact": "^8.2.0",
"preact-compat": "^3.17.0",
"preact-context": "^1.1.3"
"preact": "^10.0.0"
},
"dependencies": {
"module-alias": "2.0.6"
Expand Down
6 changes: 0 additions & 6 deletions packages/next-preact/preact-compat.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/next-preact/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Use [preact](https://preactjs.com/) with [Next.js](https://github.com/zeit/next.
## Installation

```
npm install --save @zeit/next-preact preact preact-compat preact-context
npm install --save @zeit/next-preact preact preact-ssr-prepass
```

or

```
yarn add @zeit/next-preact preact preact-compat preact-context
yarn add @zeit/next-preact preact preact-ssr-prepass
```

## Usage
Expand Down