Skip to content

preprocess

effectPreprocess(...) is the low-level .svelte preprocessor entry used by the plugin.

ts
import { effectPreprocess } from "svelte-effect-runtime/preprocess";

Most apps should use effect() from "svelte-effect-runtime" instead. Reach for effectPreprocess(...) only when you need to compose the transform manually.

Signature

ts
export interface EffectPreprocessOptions {
  runtimeModuleId?: string;
  effectModuleId?: string;
  svelteModuleId?: string;
}

export function effectPreprocess(
  options?: EffectPreprocessOptions,
): PreprocessorGroup;

Semantics

  • Rewrites <script effect> blocks.
  • Rewrites supported markup yield* expressions.
  • Injects runtime imports using runtimeModuleId.
  • Injects Effect imports using effectModuleId.
  • Uses svelteModuleId for Svelte runtime helpers.

BSD-3-Clause