Skip to content

Commit 3251ef2

Browse files
committed
Tweak message futher
1 parent e3672fe commit 3251ef2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/react-dev-utils/formatWebpackMessages.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ function formatMessage(message, isError) {
102102
];
103103
}
104104

105+
if (lines[1].match(/Cannot find module.+node-sass/)) {
106+
lines[1] =
107+
'To import Sass files in this project, you need to install node-sass.\n';
108+
lines[1] +=
109+
'Please run `npm i node-sass --save` or `yarn add node-sass` inside your workspace.';
110+
}
111+
105112
// Cleans up syntax error messages.
106113
if (lines[1].indexOf('Module build failed: ') === 0) {
107114
lines[1] = lines[1].replace(
@@ -133,12 +140,6 @@ function formatMessage(message, isError) {
133140
);
134141
}
135142

136-
if (lines[1].match(/sass-loader.+node-sass.+install/)) {
137-
lines[1] = 'You need to install `node-sass` to compile Sass files.\n';
138-
lines[1] +=
139-
'Please run `npm i node-sass` or `yarn add node-sass` inside your workspace.';
140-
}
141-
142143
lines[0] = chalk.inverse(lines[0]);
143144

144145
// Reassemble the message.

0 commit comments

Comments
 (0)