In your webpack config:
resolve: {
alias: {
'react': 'preact-compat-lite',
'react-dom': 'preact-compat-lite'
}
}| import { * as preact } from 'preact'; | |
| export * from 'preact'; | |
| import { * as hooks } from 'preact'; | |
| export * from 'preact/hooks'; | |
| const toArray = preact.toChildArray; | |
| const map = (c, f) => c && toArray(toArray(c).map(f)); | |
| export const Children = preact.Children = { | |
| map: map, | |
| forEach: map, | |
| toArray: toArray, | |
| only: c => toArray(c)[0], | |
| count: c => c && toArray(c).length || 0 | |
| }; | |
| export default Object.assign(preact, hooks); |