CJY0208 / react-activation

Hack <KeepAlive /> for React
https://www.npmjs.com/package/react-activation
MIT License
1.79k stars 141 forks source link

vite 运行时一切正常, build后报错 : jsxDevRuntime.exports.jsxDEv is not a function #267

Closed slowlyo closed 1 year ago

slowlyo commented 1 year ago

问题代码

<Switch location={location}>
    {flattenRoutes.map(({path, component}, index) => {
        return <Route key={index} path={path} render={() => (
            <KeepAlive name={path}
                        cacheKey={path}
                        when={settings.keepAlive && appSettings.layout?.keep_alive_exclude.indexOf(path) == -1}>
                {React.createElement(component)}
            </KeepAlive>
        )}/>
    })}
    <Route exact path="/">
        <Redirect to={`/${defaultRoute}`}/>
    </Route>
    {flattenRoutes.length && (
        <Route
            path="*"
            component={lazyLoad(() => import("@/pages/exception/403"))}
        />
    )}
</Switch>

描述

如果我使用 KeepAlive 组件把我的组件包裹起来, build后就会报错~ 运行时一切正常

slowlyo commented 1 year ago

其他原因~ 已解决