File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ Use [the changelog guidelines](/documentation/Versioning%20and%20changelog.md) t
1717
1818### Development workflow
1919
20+ - Improve error logging in the event of sass errors. ([ #4954 ] ( https://github.com/Shopify/polaris-react/pull/4954 ) )
21+
2022### Dependency upgrades
2123
2224### Code quality
Original file line number Diff line number Diff line change 11const path = require ( 'path' ) ;
2- const { promisify} = require ( 'util' ) ;
32
43const { createFilter} = require ( '@rollup/pluginutils' ) ;
54const nodeSass = require ( 'node-sass' ) ;
@@ -22,8 +21,6 @@ module.exports.styles = function styles({
2221
2322 const filter = createFilter ( include , exclude ) ;
2423
25- const renderSass = promisify ( nodeSass . render ) ;
26-
2724 const styleProcessor = postcss ( [
2825 cssModules ( {
2926 ...modules ,
@@ -148,11 +145,19 @@ module.exports.styles = function styles({
148145 return null ;
149146 }
150147
151- const sassOutput = await renderSass ( {
152- data : source ,
153- outputStyle : 'compact' ,
154- includePaths : [ path . dirname ( id ) ] ,
155- } ) . then ( ( result ) => result . css . toString ( ) ) ;
148+ let sassOutput ;
149+ try {
150+ sassOutput = nodeSass
151+ . renderSync ( {
152+ data : source ,
153+ file : id ,
154+ outputStyle : 'compact' ,
155+ includePaths : [ path . dirname ( id ) ] ,
156+ } )
157+ . css . toString ( ) ;
158+ } catch ( err ) {
159+ throw new Error ( err . formatted ) ;
160+ }
156161
157162 const postCssOutput = await styleProcessor
158163 . process ( sassOutput , { from : id } )
You can’t perform that action at this time.
0 commit comments