Skip to content

Commit

Permalink
Adjust readme
Browse files Browse the repository at this point in the history
  • Loading branch information
non25 committed Jan 19, 2021
1 parent 3a49db4 commit e353a4c
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,26 +278,13 @@ module.exports = {

## Using svelte-loader in combination with thread-loader

There is a way to make `svelte-loader` support `thread-loader`.
By default `svelte-loader` uses a Map to store css, and passes keys to that Map through custom loader string in query parameter.

Enable `inlineCss: true` in options as shown below. It will make `svelte-loader` output component css in base64 as a query string to webpack, instead of saving it to a Map, and passing key to that map.
This won't work for multiple `thread-loader` processess. `css-loader` won't find component's css in a Map that is located in other process.

This will make console output unpleasant to look at, but `thread-loader` will have access to the css data it needs to function properly.
If you set up `thread-loader` on top of `svelte-loader` however, it will pass whole base64'd css in a query, without using Map.

```javascript
...
{
test: /\.(html|svelte)$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
inlineCss: true,
},
},
},
...
```
It will clutter the console output, but you will gain compilation speed, especially when using `tailwindcss` with `@apply` through `svelte-preprocess`.

## License

Expand Down

0 comments on commit e353a4c

Please sign in to comment.