⚠ This config is experimental and its behavior may change in any vite-plugin-ssr minor version update.

By default, static assets (CSS, images, ...) cannot be imported by server-side-only code.

But we can set includeAssetsImportedByServer to true to enable static assets to be imported from server-side-only code.

For example:

// /**/*.page.server.js
// Environment: Node.js

// This file is loaded *only* in Node.js

// We need to set `includeAssetsImportedByServer` to `true` if we want
// `some-style.css` to be included, otherwise it will be ignored.
import './some-style.css'

// Same for other static assets such as images, fonts, etc.
import imageUrl from './some-image.svg'

// Prints `undefined` if `includeAssetsImportedByServer` isn't `true`.
// vite.config.js

import { ssr } from 'vite-plugin-ssr/plugin'

export default {
  plugins: [
      includeAssetsImportedByServer: true