webpack: Check if sassc is installed
If so, show the versions, which may be useful for comparing builds. If not, show an useful error message. Previously, you were left with ~ 80 identical unintelligible error messages and leftover temporary directories. Closes #404 Fixes #391
This commit is contained in:
parent
18354174de
commit
8821db1daf
1 changed files with 13 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const childProcess = require('child_process');
|
||||||
const copy = require("copy-webpack-plugin");
|
const copy = require("copy-webpack-plugin");
|
||||||
const extract = require("mini-css-extract-plugin");
|
const extract = require("mini-css-extract-plugin");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
|
|
@ -47,6 +48,18 @@ const babel_loader = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check if sassc is available, to avoid unintelligible error messages */
|
||||||
|
try {
|
||||||
|
childProcess.execFileSync('sassc', ['--version'], { stdio: ['pipe', 'inherit', 'inherit'] });
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code === 'ENOENT') {
|
||||||
|
console.error("ERROR: You need to install the 'sassc' package to build this project.");
|
||||||
|
process.exit(1);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: production ? 'production' : 'development',
|
mode: production ? 'production' : 'development',
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue