insin / nwb

A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)
Other
5.58k stars 331 forks source link

Dart-sass support #553

Open markboyessmith opened 4 years ago

markboyessmith commented 4 years ago

This issue is a: Question / support request

Currently using nwb-sass for sass support. This gives us sass compilation via node-sass.

Looking to move over to pure sass (dart-sass) but unable to get nwb config file to pick this up successfully.

module.exports = {
  webpack: {
    rules: {
      sass: {
        loader: require.resolve('sass-loader'),
        options: {
          implementation: require.resolve('sass'),
        }
      }
    }
  }
}

Any ideas?

ianizaguirre commented 3 years ago

@markboyessmith I figured it out.

I added this to my nwb webpack rules:

    rules: {
      sass: {
        loader: "sass-loader",
        // Prefer `dart-sass`
        implementation: require("sass"),
      },
    },

and installed these 2 packages in my package.json:

    "sass": "^1.32.11",
    "sass-loader": "^10.1.1"

For reference I have the following nwb version installed:

    "nwb": "^0.25.2",
    "nwb-sass": "^0.10.2",

and its working for me now using dart-sass.