UNPKG

oc-template-esm-compiler

Version:
24 lines (20 loc) 814 B
export const appBlock = ({ name, version, entry }) => ` <div id="root"></div> <script type="module"> const data = __INITIAL_DATA__; window.__$$oc_initialData__ = Object.freeze(data); const settings = Object.freeze({ baseUrl: '/', id: 'root', name: '${name}', staticPath: '/', version: '${version}' }); window.__$$oc_Settings__ = settings; window.oc = window.oc || {}; window.oc.cmd = window.oc.cmd || []; import component from "${entry}"; const container = document.getElementById('root'); const methods = typeof component === 'function' ? component() : component; methods.mount(container, data); window.oc.cmd.push(() => { window.oc.events.fire('oc:rendered', { ...settings, element: container, }); }); </script> `; export const plugin = () => { }; //# sourceMappingURL=hmr.js.map