Next-plugins: [next-sass] allow use `sass` replace `node-sass`

Created on 8 Jan 2020  路  9Comments  路  Source: vercel/next-plugins

hope can allow use sass replace node-sass

Most helpful comment

@chrisandrewca

 "sass": "1.14.1",
 "sass-loader": "7.1.0"

Remember to add sass-loader in dependencies.

All 9 comments

How about this:

withSass({
 sassLoaderOptions: {
    implementation: require('sass')
  }
})

why not let it auto handle, let user just need choose install node-sass or sass

This doesn't work for me

// next.config.js
const withSass = require('@zeit/next-sass');
const sass = require('sass');

module.exports = withSass({
    cssModules: true,
    sassLoaderOptions: {
        implementation: sass,
    },
});

```shell
Error: Cannot find module 'node-sass'

```json
"@zeit/next-sass": "1.0.1",
"sass": "1.25.0"

@in-in before they take this pr, or maybe never

u can try use this code in package.json and use yarn

"dependencies": {
"node-sass": "npm:sass"
}

@in-in I test the config locally, it works.
By the way, does your project work with node-sass?

Yes _Sass_ files compiles without any problems with node-sass ("4.13.1")

@tingtingtinghuang Could you post your package.json and next.config?

I'm using

module.exports =
  withBundleAnalyzer(
    withSass({
      webpack(config, ) {
        config.node = {
          fs: 'empty'
        };
        return config;
      },
      sassLoaderOptions: {
        implementation: require('sass')
      }
    }));
"@zeit/next-sass": "^1.0.1",
"sass": "^1.25.0"

and also get the error: Error: Cannot find module 'node-sass'

I import my .scss in a component, not the _app.

@chrisandrewca

 "sass": "1.14.1",
 "sass-loader": "7.1.0"

Remember to add sass-loader in dependencies.

Hi, thanks for creating an issue. We currently recommend using nextjs.org/docs/basic-features/built-in-css-support as the plugins have been deprecated in favor of the built-in support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

popuguytheparrot picture popuguytheparrot  路  4Comments

derindutz picture derindutz  路  3Comments

tim-phillips picture tim-phillips  路  4Comments

mitaxe picture mitaxe  路  4Comments

danikaze picture danikaze  路  3Comments