tiptap/demos/setup/react.ts
Ben Asher e97630c639
Require file extensions for imports and exports (#4001)
* Require .js endings

* add extension alias for cypress to resolve ts files with js endings
2023-06-30 21:03:49 +02:00

26 lines
629 B
TypeScript

import 'iframe-resizer/js/iframeResizer.contentWindow'
import './style.scss'
import React from 'react'
import { createRoot } from 'react-dom/client'
import { debug, splitName } from './helper.js'
export default function init(name: string, source: any) {
// @ts-ignore
window.source = source
document.title = name
const [demoCategory, demoName] = splitName(name)
import(`../src/${demoCategory}/${demoName}/React/index.jsx`)
.then(module => {
const root = document.getElementById('app')
if (root) {
createRoot(root).render(React.createElement(module.default))
}
debug()
})
}