Skip to content

Commit 2dbac89

Browse files
authored
docs: use ES6 module imports (#154)
1 parent 52dccb7 commit 2dbac89

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export default {
306306
307307
```js
308308
// svelte.config.js
309-
const sveltePreprocess = require('svelte-preprocess');
309+
import sveltePreprocess from 'svelte-preprocess';
310310
311311
module.exports = {
312312
preprocess: sveltePreprocess({
@@ -327,7 +327,7 @@ _Tip: this file can be imported in your bundle config instead of having multiple
327327
In auto preprocessing mode, `svelte-preprocess` automatically uses the respective preprocessor for your code based on your `type="..."` or `lang="..."` attributes. It also handles the `<template>` tag for markup, external files and global styling. It's as simple as importing the module and executing the default exported method.
328328
329329
```js
330-
const sveltePreprocess = require('svelte-preprocess')
330+
import sveltePreprocess from 'svelte-preprocess'
331331
332332
...
333333
{
@@ -341,8 +341,8 @@ const sveltePreprocess = require('svelte-preprocess')
341341
[Svelte v3 has added support for multiple processors](https://svelte.dev/docs#svelte_preprocess), so it's also possible to use `svelte-preprocess` with other preprocessors:
342342
343343
```js
344-
const sveltePreprocess = require('svelte-preprocess')
345-
const { mdsvex } = require('mdsvex')
344+
import sveltePreprocess from 'svelte-preprocess'
345+
import { mdsvex } from 'mdsvex'
346346
...
347347
{
348348
/* svelte options */
@@ -400,8 +400,8 @@ svelte.preprocess(input, [
400400
`svelte-preprocess` in _auto-processing_ mode can receive an options object.
401401
402402
```js
403-
const svelte = require('svelte');
404-
const sveltePreprocess = require('svelte-preprocess');
403+
import svelte from 'svelte';
404+
import sveltePreprocess from 'svelte-preprocess';
405405
const options = {
406406
/**
407407
* Define which tag should `svelte-preprocess` look for markup content.
@@ -596,7 +596,7 @@ If you have configured `svelte-preprocess` to use some kind of preprocessor and
596596
If you have a medium-to-big project, the typescript processor might start to get slow. If you already have an IDE type checking your code, you can speed up the transpilation process by setting `transpileOnly` to `true`:
597597
598598
```js
599-
const preprocess = require('svelte-preprocess')
599+
import preprocess from 'svelte-preprocess'
600600
...
601601
{
602602
...svelteOptions,

0 commit comments

Comments
 (0)