From ddc7cc07980bdd960f11901f2d97e57a099b952f Mon Sep 17 00:00:00 2001 From: Chocolate1999 <2816778271@qq.com> Date: Mon, 12 Sep 2022 17:30:19 +0800 Subject: [PATCH] chore: convert react to preact in production --- next.config.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/next.config.js b/next.config.js index 3f1d668..955b6fb 100644 --- a/next.config.js +++ b/next.config.js @@ -4,25 +4,23 @@ module.exports = { dirs: ['src'], }, - // reactStrictMode: true, - // Uncoment to add domain whitelist images: { domains: ['res.cloudinary.com'], }, - // webpack: (config, { dev, isServer }) => { - // // Replace React with Preact only in client production build - // if (!dev && !isServer) { - // Object.assign(config.resolve.alias, { - // react: 'preact/compat', - // 'react-dom/test-utils': 'preact/test-utils', - // 'react-dom': 'preact/compat', - // }); - // } + webpack: (config, { dev, isServer }) => { + // Replace React with Preact only in client production build + if (!dev && !isServer) { + Object.assign(config.resolve.alias, { + react: 'preact/compat', + 'react-dom/test-utils': 'preact/test-utils', + 'react-dom': 'preact/compat', + }); + } - // return config; - // }, + return config; + }, }; const intercept = require('intercept-stdout');