Files
site-builder/craft/src/main.tsx
T

27 lines
1.0 KiB
TypeScript
Raw Normal View History

import React from 'react';
import ReactDOM from 'react-dom/client';
import { App } from './App';
import { WhpConfig } from './types';
import { installConsoleErrorBuffer } from './utils/console-buffer';
import { editorBuild } from './utils/build-stamp';
import './styles/editor.css';
// Installed before React mounts so errors thrown during the first render are
// captured too.
installConsoleErrorBuffer();
// Logged so the build that produced a given session is visible in the
// browser console; also the only current reference to `editorBuild()`,
// which keeps the __EDITOR_BUILD__-reading module from being tree-shaken
// out of the bundle before Task 19 wires it into the report payload.
console.log(`[site-builder] build ${editorBuild()}`);
// Read WHP_CONFIG injected by PHP wrapper (or null for standalone dev)
const whpConfig: WhpConfig | null = (window as any).WHP_CONFIG || null;
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App whpConfig={whpConfig} />
</React.StrictMode>
);