@ -193,9 +194,9 @@ The `markup` function receives the entire component source text, along with the
> Preprocessor functions may additionally return a `map` object alongside `code` and `dependencies`, where `map` is a sourcemap representing the transformation. In current versions of Svelte it will be ignored, but future versions of Svelte may take account of preprocessor sourcemaps.
```js
const {preprocess} = require('svelte/compiler');
const svelte = require('svelte/compiler');
const { code } = preprocess(source, {
const { code } = svelte.preprocess(source, {
markup: ({ content, filename }) => {
return {
code: content.replace(/foo/g, 'bar')
@ -213,11 +214,11 @@ The `script` and `style` functions receive the contents of `<script>` and `<styl
If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example).
Multiple preprocessors can be used together. The output of the first becomes the input to the second. `markup` functions run first, then `script` and `style`.