Skip to content

Commit d1dcf88

Browse files
authored
docs: note preprocess
1 parent 7657b52 commit d1dcf88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,24 @@ use: {
183183
...
184184
```
185185

186+
### Using preprocessors like TypeScript
187+
188+
Install [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) and add it to the loader options:
189+
190+
```js
191+
const sveltePreprocess = require('svelte-preprocess');
192+
...
193+
use: {
194+
loader: 'svelte-loader',
195+
options: {
196+
preprocess: sveltePreprocess()
197+
},
198+
},
199+
...
200+
```
201+
202+
Now you can use other languages inside the script and style tags. Make sure to install the respective transpilers and add a `lang` tag indicating the language that should be preprocessed. In the case of TypeScript, install `typescript` and add `lang="ts"` to your script tags.
203+
186204
### Hot Reload
187205

188206
This loader supports component-level HMR via the community supported [svelte-hmr](https://github.com/rixo/svelte-hmr) package. This package serves as a testbed and early access for Svelte HMR, while we figure out how to best include HMR support in the compiler itself (which is tricky to do without unfairly favoring any particular dev tooling). Feedback, suggestion, or help to move HMR forward is welcomed at [svelte-hmr](https://github.com/rixo/svelte-hmr/issues) (for now).

0 commit comments

Comments
 (0)