arpadHegedus / postcss-node-sass

A PostCSS plugin to parse styles with node-sass
MIT License
23 stars 16 forks source link

Handle when res.map is null #7

Closed Kiikurage closed 5 years ago

Kiikurage commented 5 years ago

First, thank you for this useful plugin!

Few days ago I found that sometime transpile from SASS to CSS was failed because of following error:

TypeError: Cannot read property 'toString' of undefined
    at Promise.then.res (postcss-node-sass/index.js:38:42)

I investigated the reason why this error was occurred. PostCSS pass result parameter to each plugin. For some reasons, sometime result.opts.to is null, and in this case, node-sass doesn't generate source map because opt.outFile is not specified (postcss-node-sass/index.js#L27, node-sass/index.js#L54-L56).

To handle this case, I did small fix. Please review it.

Thanks.