Skip to content

🚧 Do the Chunk split on a page-by-page basis. In the svelte-spa-router module.

License

Notifications You must be signed in to change notification settings

hmmhmmhm/svelte-spa-chunk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svelte-spa-chunk

🚧 Do the Chunk split on a page-by-page basis. In the svelte-spa-router module.

svelte-spa-chunk module allows you to apply code splitting on each page in the svelte-spa-router. Dynamic import is implemented to automatically call only when rendering through svelte-lodable .

Install

npm i svelte-spa-chunk

Usage

Apply the following to the route map of the svelte-spa-router:

import { ChunkGenerator } from 'svelte-spa-chunk'
import ChunkComponent from 'svelte-spa-chunk/Chunk.svelte'
const Chunk = ChunkGenerator(ChunkComponent)

/**
 * @description Client Side Render Index
 */
export default {
    '/':        Chunk(()=> import('./main.svelte')),
    '/a':       Chunk(()=> import('./a.svelte')),
    '/b':       Chunk(()=> import('./b.svelte')),
    '/async':   Chunk(()=> import('./async.svelte')),

    '*':        Chunk(()=> import('./main.svelte')),
}

License

MIT Licensed.

About

🚧 Do the Chunk split on a page-by-page basis. In the svelte-spa-router module.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published