Registry / web-framework / rollup-plugin-svelte-ssr

rollup-plugin-svelte-ssr

JSON →
library1.0.3jsnpmunverified

Server-side rendering of a Svelte app at build-time using a Rollup plugin. Current stable version is 1.0.3, last released in June 2020. The plugin pre-renders a Svelte component with specified props during the Rollup build, outputting static HTML and CSS files. Differentiators: simple Rollup integration, supports custom output file naming, CSS/HTML preprocessing, and selective JS file emission. Ideal for generating static HTML for Svelte apps in a Rollup build pipeline. Note: This project appears to be in maintenance mode with no recent updates.

npm install rollup-plugin-svelte-ssr
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-SVEL
R
rollup-plugin-svelte-ssr
web-frameworkjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import ssr from 'rollup-plugin-svelte-ssr'
const ssr = require('rollup-plugin-svelte-ssr')
Package exposes a default export as a function.
ssr
import ssr from 'rollup-plugin-svelte-ssr'
import { ssr } from 'rollup-plugin-svelte-ssr'
Named import incorrectly used; only default export exists.
RollupPluginSvelteSsr
import ssr from 'rollup-plugin-svelte-ssr'
import RollupPluginSvelteSsr from 'rollup-plugin-svelte-ssr'
The default export is a function, not a class. Renaming is allowed but not necessary.

Rollup config to SSR a Svelte component into a static HTML file during build.

// rollup.config.js import svelte from 'rollup-plugin-svelte'; import ssr from 'rollup-plugin-svelte-ssr'; export default { input: 'src/App.svelte', output: { format: 'cjs', file: 'dist/ssr.js', }, plugins: [ svelte({ generate: 'ssr' }), ssr({ fileName: 'ssr.html', props: { name: 'World' }, }), ], }; // Assumes a Svelte component at src/App.svelte with export let name;
Debug
Known issues
gotchaThe plugin expects svelte({ generate: 'ssr' }) to be used before the ssr plugin. Order matters.
fix
Place the svelte plugin with generate: 'ssr' before the ssr plugin in the plugins array.
affects: >=1.0.0
deprecatedThis package has not been updated since June 2020. It may not support newer Svelte or Rollup versions.
fix
Consider using built-in SvelteKit SSR or other actively maintained solutions.
affects: >=1.0.0
gotchaThe props option only supports static props at build time; runtime dynamic props are not possible.
fix
Use environment variables or build-time configuration to inject dynamic values.
affects: >=1.0.0
gotchaIf skipEmit is set to false (default), the JS output file will still be emitted even though SSR HTML is generated. This may cause confusion.
fix
Set skipEmit: true if you only need the HTML output.
affects: >=1.0.0
Errors
Common errors & fixes
Error: generate option must be 'dom' or 'ssr'
Missing or incorrect generate option in svelte plugin.
fix
Add svelte({ generate: 'ssr' }) to your Rollup config.
TypeError: ssr is not a function
Using a named import instead of default import.
fix
Use 'import ssr from "rollup-plugin-svelte-ssr"' instead of 'import { ssr } from ...'.
The plugin 'rollup-plugin-svelte-ssr' is not compatible with Rollup 3+
The plugin was built for Rollup 1.x/2.x and may break with Rollup 3.x.
fix
Use an older version of Rollup or look for an alternative plugin.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
rolluprequiredRequired as a peer dependency to function as a Rollup plugin.
svelterequiredRequired to compile Svelte components for SSR.
Agent activity
9 hits · last 30 days
node
6
Amazon
1
Resources
rollup-plugin-svelte-ssr — npm install rollup-plugin-svelte-ssr · libregistry