Dynamic Import for web.cordova not working

Hello Meteorians,

I’m currently trying to reduce the Cordova App Size by using dynamic imports. I have the plotly library, size 3.5 mb. It is reduced in the webApp, but in web.cordova, size is still the same. I added a screenshot using

meteor --extra-packages bundle-visualizer --production

Here’s the source code. I also tried “@loadable/component”, which works for webApp, but not for web.cordova.

import React, { Suspense } from 'react'

const Plot = React.lazy(() => import('../../../../../node_modules/react-plotly.js/react-plotly'))


export default function LazyPlot(props) {
    return (
        <Suspense fallback={<div></div>}>
            <Plot {...props} />
        </Suspense>
    )
}

Thank you for helping me :smile:

In a cordova app, the entire client app is bundled with the app as installed/downloaded in the device. There is no point in lazy loading in this case.

1 Like

Hi,

I’d say the initial javascript parsing time and the used memory of the application code would be different if some modules could be loaded lazily (or possibly never), or is this not correct?

1 Like

Hi, i’m interested in this too…