diff --git a/webpack.config.babel.js b/webpack.config.babel.js index 23b553b..2840dcb 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -390,11 +390,6 @@ export default (options) => { '.js', '.json', '.jsx', ], alias: { - // Use preact instead of react - /* react: 'preact-compat\\dist\\preact-compat', - 'react-dom': 'preact-compat\\dist\\preact-compat', - 'create-react-class': 'preact-compat/lib/create-react-class', */ - 'moment-timezone': 'moment-timezone/builds/moment-timezone-with-data-2012-2022.js', }, }, @@ -413,4 +408,15 @@ export default (options) => { ], }, }; + + if (!server) { + // Use preact instead of react (only on static build) + Object.assign(config.resolve.alias, { + react: !server ? 'preact-compat\\dist\\preact-compat' : undefined, + 'react-dom': !server ? 'preact-compat\\dist\\preact-compat' : undefined, + 'create-react-class': !server ? 'preact-compat/lib/create-react-class' : undefined, + }); + } + + return config; };