svelte-spa-chunk

2.0.0 • Public • Published

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.

Package Sidebar

Install

npm i svelte-spa-chunk

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

6.27 kB

Total Files

10

Last publish

Collaborators

  • hmmhmmhm