FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 922 forks source link

🐛 BUG: Sass Plugin isn't working #3657

Open Artrix9095 opened 3 years ago

Artrix9095 commented 3 years ago

Quick checklist

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the bug

So I'm trying to make a simple react typescript app with snowpack, using sass as styling. Every time I try to run the app I get a error saying that main.scss isn't found when it literally exists, I also tried building the project and running it like that but that also did nothing, I watched some tutorials and they were using the same method I was and it still didn't work. I'm looking for some advice here on how to make this work, all help is appreciated image

Steps to reproduce

  1. npx create-snowpack-app using template react typescript
  2. npm i @snowpack/plugin-sass
  3. go into your snowpack.config.js and put in the following information into your plugins array
    [
      '@snowpack/plugin-sass',
      {
        native: true,
        compilerOptions: {
          loadPath: 'styles',
          sourceMap: true,
          style: 'compressed',
        },
      },
    ]
  4. Create a sass/scss file in a folder called styles, import it in the App.jsx file and run npm start
  5. When i do this i get a error saying that the file is not found image

Link to minimal reproducible example (optional)

No response

jacty commented 3 years ago

It is ...quite strange here. For resolving this issue here, you just need to remove 'sourceMap:true' in your config, since it is a default value. And when you explicit 'sourceMap:true', then you also need to explicit 'embedSourceMap:true' in your config..., which is quite confusing here is 'embedSourceMap:false' should be accepted however get an error from Sass. I don't use sourceMap so often, not very sure why..