svelte-reactive-preprocessor Svelte Themes

Svelte Reactive Preprocessor

Svelte Reactive Preprocessor

Wrap svelte reactive statements with custom events to allow devtools to detect them

How to install

npm i -D svelte-reactive-preprocessor

How to use

First import the package like this

const { reactivePreprocess } = require("svelte-reactive-preprocessor");

Then in the svelte loader options, add the reactive preprocessor like this

plugins: [
  svelte({
    preprocess: reactivePreprocess(),
  }
],

If you are already using another preprocessor, add the reactive preprocessor like this

preprocess: [
  sveltePreprocess(),
  reactivePreprocess(),
],

Options

The preprocessor options are listed below with their default values

reactivePreprocess({
  enabled: true,
  state: true,
})

enabled: boolean

Enable or disable the preprocessor

state: boolean

Whether to send the state to devtools. Set to false if you encounter performance issues.

Top categories

Loading Svelte Themes