From 9fb4366f72d6bacc4ab477ac19eb30e834a7f521 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Sat, 31 Jul 2021 00:33:49 +0800 Subject: [PATCH] chore: follow the offical example --- next.config.js | 8 ++++- package.json | 8 +++-- yarn.lock | 80 ++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 71 insertions(+), 25 deletions(-) diff --git a/next.config.js b/next.config.js index 4a4169868..f063a81b0 100755 --- a/next.config.js +++ b/next.config.js @@ -7,6 +7,7 @@ const withOffline = require('next-offline') const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }) +const withPreact = require('next-plugin-preact') const offlineConfig = require('./config/next_offline') // Use the SentryWebpack plugin to upload the source maps during build step @@ -39,6 +40,11 @@ const nextConfig = { } module.exports = withPlugins( - [withBundleAnalyzer, withSourceMaps, [withOffline, offlineConfig]], + [ + withPreact, + withBundleAnalyzer, + withSourceMaps, + [withOffline, offlineConfig], + ], nextConfig, ) diff --git a/package.json b/package.json index 8c4ddb3a8..541cfa6a2 100644 --- a/package.json +++ b/package.json @@ -94,22 +94,25 @@ "next-compose-plugins": "^2.2.0", "next-i18next": "4.4.1", "next-offline": "4.0.6", + "next-plugin-preact": "^3.0.6", "nextjs-progressbar": "^0.0.6", "overlayscrollbars": "1.13.1", "path-match": "^1.2.4", "polished": "4.1.3", + "preact": "^10.5.14", + "preact-render-to-string": "^5.1.19", "promise-timeout": "^1.3.0", "prop-types": "^15.5.10", "pubsub-js": "^1.9.3", "qrcode-react": "^0.1.16", "ramda": "0.26.1", - "react": "17.0.2", + "react": "npm:@preact/compat", "react-animation": "^1.2.2", "react-calendar-heatmap": "1.8.1", "react-content-loader": "3.4.2", "react-copy-to-clipboard": "^5.0.3", "react-device-detect": "^1.17.0", - "react-dom": "17.0.2", + "react-dom": "npm:@preact/compat", "react-highlight-words": "^0.16.0", "react-lazy-load-image-component": "1.5.0", "react-masonry-component": "^6.0.1", @@ -118,6 +121,7 @@ "react-resize-detector": "4.2.3", "react-select": "^3.1.0", "react-sortable-hoc": "1.7.1", + "react-ssr-prepass": "^1.4.0", "react-svg": "11.1.2", "react-swipeable": "^5.5.1", "react-textarea-autosize": "^8.3.0", diff --git a/yarn.lock b/yarn.lock index ccfe3d687..7176b6030 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1002,6 +1002,34 @@ version "2.9.2" resolved "https://registry.npm.taobao.org/@popperjs/core/download/@popperjs/core-2.9.2.tgz#adea7b6953cbb34651766b0548468e743c6a2353" +"@prefresh/babel-plugin@0.4.1": + version "0.4.1" + resolved "https://registry.nlark.com/@prefresh/babel-plugin/download/@prefresh/babel-plugin-0.4.1.tgz#c4e843f7c5e56c15f1185979a8559c893ffb4a35" + +"@prefresh/core@^1.3.1": + version "1.3.2" + resolved "https://registry.nlark.com/@prefresh/core/download/@prefresh/core-1.3.2.tgz#97f966759b16e5f4c52361972e3c61ccac9ce396" + +"@prefresh/next@^1.4.6": + version "1.4.6" + resolved "https://registry.nlark.com/@prefresh/next/download/@prefresh/next-1.4.6.tgz#1ec73696ba6fd39aaac8db506c506fcd29aa5f31" + dependencies: + "@prefresh/babel-plugin" "0.4.1" + "@prefresh/core" "^1.3.1" + "@prefresh/utils" "^1.0.0" + "@prefresh/webpack" "^3.2.0" + +"@prefresh/utils@^1.0.0", "@prefresh/utils@^1.1.0": + version "1.1.1" + resolved "https://registry.nlark.com/@prefresh/utils/download/@prefresh/utils-1.1.1.tgz#ffe7f2e6bd48a0633631a3d92c0ee4bdeb0ac330" + +"@prefresh/webpack@^3.2.0", "@prefresh/webpack@^3.3.0": + version "3.3.2" + resolved "https://registry.nlark.com/@prefresh/webpack/download/@prefresh/webpack-3.3.2.tgz#058c4d61d733a4a8c111486f8aa1ae9b89820d9c" + dependencies: + "@prefresh/core" "^1.3.1" + "@prefresh/utils" "^1.1.0" + "@rushstack/eslint-patch@^1.0.6": version "1.0.6" resolved "https://registry.npm.taobao.org/@rushstack/eslint-patch/download/@rushstack/eslint-patch-1.0.6.tgz#023d72a5c4531b4ce204528971700a78a85a0c50" @@ -8026,7 +8054,7 @@ modify-values@^1.0.0: version "1.0.1" resolved "https://registry.nlark.com/modify-values/download/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" -module-alias@^2.0.1: +module-alias@^2.0.0, module-alias@^2.0.1: version "2.2.2" resolved "https://registry.npm.taobao.org/module-alias/download/module-alias-2.2.2.tgz#151cdcecc24e25739ff0aa6e51e1c5716974c0e0" @@ -8178,6 +8206,14 @@ next-offline@4.0.6: webpack "^4.19.1" workbox-webpack-plugin "^4.3.1" +next-plugin-preact@^3.0.6: + version "3.0.6" + resolved "https://registry.nlark.com/next-plugin-preact/download/next-plugin-preact-3.0.6.tgz#22d566e8e5d50cb4cfc78360d367df44d6aaf94f" + dependencies: + "@prefresh/next" "^1.4.6" + "@prefresh/webpack" "^3.3.0" + module-alias "^2.0.0" + next-tick@1, next-tick@^1.1.0: version "1.1.0" resolved "https://registry.npm.taobao.org/next-tick/download/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" @@ -9044,6 +9080,16 @@ postcss@8.2.13: nanoid "^3.1.22" source-map "^0.6.1" +preact-render-to-string@^5.1.19: + version "5.1.19" + resolved "https://registry.npm.taobao.org/preact-render-to-string/download/preact-render-to-string-5.1.19.tgz#ffae7c3bd1680be5ecf5991d41fe3023b3051e0e" + dependencies: + pretty-format "^3.8.0" + +preact@^10.5.14: + version "10.5.14" + resolved "https://registry.nlark.com/preact/download/preact-10.5.14.tgz#0b14a2eefba3c10a57116b90d1a65f5f00cd2701" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -9073,6 +9119,10 @@ pretty-format@^26.0.0, pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" +pretty-format@^3.8.0: + version "3.8.0" + resolved "https://registry.nlark.com/pretty-format/download/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385" + pretty-ms@~7.0.1: version "7.0.1" resolved "https://registry.npm.taobao.org/pretty-ms/download/pretty-ms-7.0.1.tgz#7d903eaab281f7d8e03c66f867e239dc32fb73e8" @@ -9372,13 +9422,9 @@ react-device-detect@^1.17.0: dependencies: ua-parser-js "^0.7.24" -react-dom@17.0.2: - version "17.0.2" - resolved "https://registry.nlark.com/react-dom/download/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - scheduler "^0.20.2" +"react-dom@npm:@preact/compat", "react@npm:@preact/compat": + version "0.0.4" + resolved "https://registry.nlark.com/@preact/compat/download/@preact/compat-0.0.4.tgz#f329e41caa330199eaf779c9bc9cf9556e3984a0" react-event-listener@^0.6.2: version "0.6.6" @@ -9484,6 +9530,10 @@ react-sortable-hoc@1.7.1: invariant "^2.2.4" prop-types "^15.5.7" +react-ssr-prepass@^1.4.0: + version "1.4.0" + resolved "https://registry.nlark.com/react-ssr-prepass/download/react-ssr-prepass-1.4.0.tgz#33a3db19414f0f8f9f3f781c88f760ae366b4f51" + react-svg@11.1.2: version "11.1.2" resolved "https://registry.nlark.com/react-svg/download/react-svg-11.1.2.tgz#f3364f7e8421432c48efa1826457268030cd7c9e" @@ -9592,13 +9642,6 @@ react-waypoint@9.0.2: prop-types "^15.0.0" react-is "^16.6.3" -react@17.0.2: - version "17.0.2" - resolved "https://registry.nlark.com/react/download/react-17.0.2.tgz?cache=0&sync_timestamp=1627056961584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Freact%2Fdownload%2Freact-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.nlark.com/read-pkg-up/download/read-pkg-up-1.0.1.tgz?cache=0&sync_timestamp=1618846971516&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fread-pkg-up%2Fdownload%2Fread-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -10056,13 +10099,6 @@ scheduler@^0.19.1: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.20.2: - version "0.20.2" - resolved "https://registry.nlark.com/scheduler/download/scheduler-0.20.2.tgz?cache=0&sync_timestamp=1627057076223&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fscheduler%2Fdownload%2Fscheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.nlark.com/schema-utils/download/schema-utils-1.0.0.tgz?cache=0&sync_timestamp=1626694835325&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fschema-utils%2Fdownload%2Fschema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"