saus icon indicating copy to clipboard operation
saus copied to clipboard

Add `preload` function to be called in module scope

Open aleclarson opened this issue 3 years ago • 0 comments

The goal is to allow APIs like React.lazy to be transformed into SSR friendly code. The transformation itself would be done by a Saus plugin. The preload function mentioned in this issue's title will come in handy for injecting <link rel="preload"> tags for the rewritten dynamic imports.

// Before
const Foo = React.lazy(() => import('./Foo'))

// After (SSR only)
import { preload } from 'saus/preload'
import Foo from './Foo'
preload('/src/Foo')

aleclarson avatar Apr 23 '22 00:04 aleclarson