ls-age / svelte-preprocess-sass

Svelte preprocessor for sass
91 stars 6 forks source link

Svelte.config.js #131

Closed probably-mark closed 2 years ago

probably-mark commented 2 years ago

Sveltekit is using a svelte.config.js file instead of rollup.config.js. How can we use svelte-preprocess-sass in this style?

LukasHechenberger commented 2 years ago

Well, (hopefully) like every other preprocessor 😅

import { sass } from 'svelte-preprocessor-sass';

export default {
  preprocess: [
    { style: sass() },
  ],
}

(untested)

Note: If you using a SvelteKit template svelte-preprocess is already installed and replaced this module once you add the sass module.

probably-mark commented 2 years ago

Thank you, this works, but it breaks hot reloading. Here is the error:

Exception in PromiseRejectCallback:
/workspaces/testing-preprocessors/node_modules/vite/dist/node/chunks/dep-1412e872.js:53848
        return content;

RangeError: Maximum call stack size exceeded
Exception in PromiseRejectCallback:
file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:184
  const content = await read();
                        ^

RangeError: Maximum call stack size exceeded
Exception in PromiseRejectCallback:
/workspaces/testing-preprocessors/node_modules/vite/dist/node/chunks/dep-1412e872.js:56546
    });
    ^

RangeError: Maximum call stack size exceeded
file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1399
      watcher.on(evt, (filename) => listeners.forEach((listener) => listener(filename)));
                                                                    ^

RangeError: Maximum call stack size exceeded
    at file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1399:69
    at Array.forEach (<anonymous>)
    at FSWatcher.<anonymous> (file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1399:47)
    at FSWatcher.emit (node:events:538:35)
    at file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1349:17
    at Array.forEach (<anonymous>)
    at emitChangeEventOnDependants (file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1346:16)
    at file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1399:69
    at Array.forEach (<anonymous>)
    at FSWatcher.<anonymous> (file:///workspaces/testing-preprocessors/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1399:47)