Switch to .mjs for ES Modules. Fixes #88.

This commit is contained in:
Jason Miller
2018-07-04 10:01:51 -04:00
parent 3867448aad
commit 38d0057833
2 changed files with 1 additions and 1 deletions

26
src/lib/fix-pmc.mjs Normal file
View File

@@ -0,0 +1,26 @@
import { options } from 'preact';
const classNameDescriptor = {
enumerable: false,
configurable: true,
get () {
return this.class;
},
set (value) {
this.class = value;
}
};
const old = options.vnode;
options.vnode = vnode => {
const a = vnode.attributes;
if (a != null) {
if ('className' in a) {
a.class = a.className;
}
if ('class' in a) {
Object.defineProperty(a, 'className', classNameDescriptor);
}
}
if (old != null) old(vnode);
};