Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Use [the changelog guidelines](/documentation/Versioning%20and%20changelog.md) t

### Development workflow

- Improve error logging in the event of sass errors. ([#4954](https://github.com/Shopify/polaris-react/pull/4954))

### Dependency upgrades

### Code quality
Expand Down
21 changes: 13 additions & 8 deletions config/rollup/plugin-styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const {promisify} = require('util');

const {createFilter} = require('@rollup/pluginutils');
const nodeSass = require('node-sass');
Expand All @@ -22,8 +21,6 @@ module.exports.styles = function styles({

const filter = createFilter(include, exclude);

const renderSass = promisify(nodeSass.render);

const styleProcessor = postcss([
cssModules({
...modules,
Expand Down Expand Up @@ -148,11 +145,19 @@ module.exports.styles = function styles({
return null;
}

const sassOutput = await renderSass({
data: source,
outputStyle: 'compact',
includePaths: [path.dirname(id)],
}).then((result) => result.css.toString());
let sassOutput;
try {
sassOutput = nodeSass
.renderSync({
data: source,
file: id,
outputStyle: 'compact',
includePaths: [path.dirname(id)],
})
.css.toString();
} catch (err) {
throw new Error(err.formatted);
}

const postCssOutput = await styleProcessor
.process(sassOutput, {from: id})
Expand Down