lgants
lgants

Reputation: 3845

How to add sass-loader with Webpack 1?

I recently ejected my create-react-app because I need to load sass files. Unfortunately, create-react-app uses webpack 1. But, the current version of sass-loader includes a dependency on webpack 2. The support docs don't indicate the last sass-loader version that supports webpack 1. Does anyone know where I can find this info?

Upvotes: 0

Views: 1566

Answers (1)

Gabriel Kohen
Gabriel Kohen

Reputation: 4296

You'll need to use the webpack 1 branch of the loader: https://github.com/webpack-contrib/sass-loader/tree/archive/webpack-1

As shown in the documentation: module.exports = { ... module: { loaders: [ { test: /\.scss$/, loaders: ["style-loader", "css-loader", "sass-loader"] } ] } };

And then in your react app:

require("./file.scss")

In your npm install you'd do: npm i -S npm install [email protected]

Upvotes: 3

Related Questions