import './bootstrap';
import '../css/app.css';
import '../css/ui.less';
// tdesign
import 'tdesign-react/es/style/index.css'; // 少量公共样式
import {createInertiaApp} from '@inertiajs/react'
import {createRoot} from 'react-dom/client'
import {Provider} from 'react-redux'
import store from './redux/store'

createInertiaApp({
    resolve: name => {
        // 不代码拆分
        // const pages = import.meta.glob('./Pages/**/*.tsx', {
        //     eager: true,
        // })
        // return pages[`./Pages/${name}.tsx`]

        // 代码拆分
        const pages = import.meta.glob('./Pages/**/*.tsx')
        return pages[`./Pages/${name}.tsx`]()
    }, setup({el, App, props}) {
        createRoot(el).render(<Provider store={store}>
            <App {...props} />
        </Provider>)
    },
})
