Page 1 of 1

Lazy loading Stimulsoft in React +Vite

Posted: Wed Feb 11, 2026 10:16 am
by mrapi
Hi
it is possible to lazy loading Stimulsoft in React + Vite?

In vite.convig I've created a separate js chunk for Stimulsoft:

Code: Select all

  build: {
    outDir: "../API/wwwroot",
    
  modulePreload: {
      polyfill: false,
      resolveDependencies: (_filename, deps, _context) => {
        return deps.filter(dep => !dep.includes('stimulsoft'));
      }
    },
	
    rollupOptions: {
      output: {
        manualChunks: {
          'stimulsoft': ['stimulsoft-reports-js-react/viewer'],
        }
      }
    },
	
  },

I call load only on a button click,not import it up in the component

Code: Select all

 onClick={async () => {
    ....
           const { Stimulsoft } = await import('stimulsoft-reports-js-react/viewer');
     ..
but aways I see the js package(https://mysite.com/assets/stimulsoft-BD2YVTVO.js) in netwok tab every time I start my app

thanks

Re: Lazy loading Stimulsoft in React +Vite

Posted: Thu Feb 12, 2026 7:58 am
by Lech Kulikowski
Hello,

For it to work, all modules must be loaded. Lazy loading is not possible on our side.

Thank you.

Re: Lazy loading Stimulsoft in React +Vite

Posted: Thu Feb 12, 2026 8:06 am
by mrapi
k,thanks

Re: Lazy loading Stimulsoft in React +Vite

Posted: Thu Feb 12, 2026 9:05 am
by Lech Kulikowski
Hello,

You are welcome.