Answer the question
In order to leave comments, you need to log in
Why doesn't less or sass compile in webpack?
Example from the doc
module: {
rules: [{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader",
options: {
includePaths: ["absolute/path/a", "absolute/path/b"]
}
}]
}]
}
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: ["babel-preset-react-native"],
cacheDirectory: true
}
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}, {
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader",
options: {
includePaths: ["./app/styles/style.scss", "./public/css/style.css"]
}
}]
},
{
test: /\.(png|jpg|svg|gif|ttf|eot|woff|woff2)$/,
use: "file?name=[path][name].[ext]",
}
]
},
//
ERROR in ./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js??ref--2-2!./app/styles/style.less
test: /\.less$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "less-loader", options: {
strictMath: true,
noIeCompat: true
}
}]
}, {
test: /\.scss$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "sass-loader" // compiles Sass to CSS
}]
},
Answer the question
In order to leave comments, you need to log in
You all misunderstood.
An array of paths that LibSass can look in to attempt to resolve your \@import declarations. When using data, it is recommended that you use this
"./public/css/style.css" - does not exist, so he swears.
In order to generate style files, you need to use ExtractTextPlugin .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question