Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 9d48043

Browse files
committed
refine scss errors with SASS loader option
1 parent 2856fcc commit 9d48043

File tree

5 files changed

+195
-133
lines changed

5 files changed

+195
-133
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"memory-fs": "^0.4.1",
4747
"mini-css-extract-plugin": "^0.6.0",
4848
"node-sass": "^4.12.0",
49+
"sass": "^1.20.1",
4950
"sass-loader": "^7.1.0",
5051
"style-loader": "^0.23.1",
5152
"webpack": "^4.31.0"

test/fixtures/mini-css-extract-babel-syntax/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ body {
22
color: red;
33

44
.container {
5-
margin-op: 100px;
5+
margin-top: 100px
66

77
.test {
88
vertical-align: middle;

test/fixtures/mini-css-extract-babel-syntax/webpack.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ module.exports = {
2323
MiniCssExtractPlugin.loader,
2424
'style-loader',
2525
'css-loader',
26-
'sass-loader'
26+
{
27+
loader: 'sass-loader',
28+
options: {
29+
implementation: require('sass'),
30+
}
31+
},
2732
],
2833
}
2934
]

test/integration.spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,15 @@ it('integration : mini CSS extract plugin babel error', async() => {
119119
const logs = await executeAndGetLogs('./fixtures/mini-css-extract-babel-syntax/webpack.config');
120120
const clean_logs = logs.toString().replace(/\"/g, ""); //<- double quotes issue with slash
121121
expect(clean_logs).toEqual(
122-
`ERROR Failed to compile with 1 errors,,error in ./test/fixtures/mini-css-extract-babel-syntax/index.scss,,Syntax Error: NonErrorEmittedError: (Emitted value instead of an instance of Error) ReferenceError: window is not defined,`
122+
`ERROR Failed to compile with 1 errors,,error in ./test/fixtures/mini-css-extract-babel-syntax/index.scss,,.test {
123+
^
124+
Expected digit.
125+
126+
7 │ .test {
127+
│ ^
128+
129+
stdin 7:4 root stylesheet
130+
in ${filename('fixtures/mini-css-extract-babel-syntax/index.scss')} (line 7, column 4),`
123131
);
124132
});
125133

0 commit comments

Comments
 (0)