Just import this in your app's index/entry module, before any imports that would bring in preact-material-components
.
Created
March 8, 2020 02:13
-
-
Save developit/0506e121d1245387487a235875a8124e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { options } from 'preact'; | |
const old = options.vnode; | |
options.vnode = vnode => { | |
Object.defineProperties(vnode, ALIASES); | |
if (old) old(vnode); | |
}; | |
const ALIASES = { | |
attributes: { | |
configurable: true, | |
enumerable: false, | |
get() { | |
return this.props; | |
}, | |
set(v) { | |
this.props = v; | |
} | |
}, | |
nodeName: { | |
configurable: true, | |
enumerable: false, | |
get() { | |
return this.type; | |
}, | |
set(v) { | |
this.type = v; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment