mirror of
https://github.com/jambonz/next-static-site.git
synced 2025-12-19 04:47:44 +00:00
Switch to Preact for Production builds
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
module.exports = {
|
||||
trailingSlash: true,
|
||||
};
|
||||
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;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user