Alias react to preact in static builds.
parent
fc0b06a1be
commit
7548ddcbc5
|
@ -390,11 +390,6 @@ export default (options) => {
|
||||||
'.js', '.json', '.jsx',
|
'.js', '.json', '.jsx',
|
||||||
],
|
],
|
||||||
alias: {
|
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',
|
'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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue