Alias react to preact in static builds.

feature/webpack
Icedream 2017-08-26 01:54:10 +02:00
parent fc0b06a1be
commit 7548ddcbc5
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 11 additions and 5 deletions

View File

@ -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;
};