Just import this in your app's index/entry module, before any imports that would bring in preact-material-components
.
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 { h, hydrate, Component } from 'preact'; | |
function interopDefault(mod) { | |
return mod && mod.default || mod; | |
} | |
export function ServerHydrator({ load, ...props }) { | |
const Child = interopDefault(load()); | |
return ( | |
<section> |
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
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
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
var s; | |
function supportsModuleWorkers() { | |
if (s==null) { | |
s = false; | |
try { | |
new Worker('data:,', Object.defineProperty({}, 'type', { | |
get() { s = true; } | |
})).terminate(); | |
} catch (e) {} | |
} |
This is a version of the resolve module that is extended with support for Conditional Export Maps, including Package Exports as shipped in Node.
The resolve module powers module resolution in Webpack, Rollup and Browserify.
The module maintains the same API and functionality as the original resolve() module.
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
var t,e,n,r,o,u,i,l={},c=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function a(t,e){for(var n in e)t[n]=e[n];return t}function s(t){var e=t.parentNode;e&&e.removeChild(t)}function f(t,e,n){var r,o=arguments,u={};for(r in e)"key"!==r&&"ref"!==r&&(u[r]=e[r]);if(arguments.length>3)for(n=[n],r=3;r<arguments.length;r++)n.push(o[r]);if(null!=n&&(u.children=n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===u[r]&&(u[r]=t.defaultProps[r]);return p(t,u,e&&e.key,e&&e.ref)}function p(e,n,r,o){var u={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:null,__c:null,constructor:void 0};return t.vnode&&t.vnode(u),u}function h(){return{}}function d(t){return t.children}function v(t,e){this.props=t,this.context=e}function m(t,e){if(null==e)return t.__?m(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?m(t):null}function y(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t._ |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>My page</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" /> | |
<script src="https://cdn.jsdelivr.net/combine/npm/[email protected]/umd/react.development.js,npm/[email protected]/umd/react-dom.development.js,npm/@material-ui/[email protected]/umd/material-ui.development.js,npm/@babel/[email protected]/babel.min.js" crossorigin="anonymous"></script> | |
<!-- Seperate Links | |
src: https://github.com/mui-org/material-ui/blob/master/examples/cdn/index.html --> |
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 { wrap, expose } from 'https://unpkg.com/[email protected]/dist/esm/comlink.mjs'; | |
export default name => wrap(new Worker(import.meta.url, { env:{name}, type:'module' })); | |
if (process.env.name && !self.document) { | |
const q = []; onmessage = q.push.bind(q); | |
import(process.env.name).then(expose).then(() => onmessage = q.map(dispatchEvent)) | |
} |