svelte-preprocess: Sapper - (node-)SASS - prependData doesn't seem to work

Describe the bug When I use prependData for the sass preprocessor in a Sapper project, my sass variables are not recognized. If I import them myself if the <style> tag, it works.

Logs image

internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module 'F:\Dev\Envs\yeoman\test\__sapper__\dev\server\server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []

To Reproduce https://github.com/Nokorbis/sapper-preprocess-sass-issue

Expected behavior My sass variables being prepended to my style tags

Stacktraces

Information about your project:

Additional context I had a similar issue on Svelte, but which was caused by the path format (\ instead of /), here my path is correct 😄 Node version: v12.10.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@NickKaramoff Just to see if I understood it correctly: you were using lang="scss" with a { sass: { ... } } config? If that’s it, this is happening because sass is considered an alias for scss, but the opposite is not. I’ll make this clearer in the docs

(prependData was getting “undefined” because I used sass instead of scss as key of “autoPreprocess”)

Okay… Seems to be linked to the sass library. I was using node-sass, I changed for sass, everything works.

¯_(ツ)_/¯