thgh / rollup-plugin-scss

Rollup and compile multiple .scss, .sass and .css imports
MIT License
134 stars 47 forks source link

weird deprecated and unhandled promise error #26

Closed javadbat closed 5 years ago

javadbat commented 5 years ago

when I try to convert a sass file to CSS file the file converted and created but js module don't require or import css file in transpiled js file and it throw error like below:

(node:24744) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at A:\Home\neveshafzar\work\Azad\packages\node_modules\rollup-plugin-scss\index.cjs.js:99:20
    at <anonymous>
(node:24744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a
catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24744) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:24744) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at A:\Home\neveshafzar\work\Azad\packages\node_modules\rollup-plugin-scss\index.cjs.js:99:20
    at <anonymous>
(node:24744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a
catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:24744) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at A:\Home\neveshafzar\work\Azad\packages\node_modules\rollup-plugin-scss\index.cjs.js:99:20
    at <anonymous>
(node:24744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a
catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
javadbat commented 5 years ago

any solution?

kellerza commented 5 years ago

Change this line to

          if (!css || !css.length) {
poradz commented 4 years ago

Thanks, @kellerza, it solves the problem. @thgh, please include this correction in the next version, I can make PR, if you want. Thanks in advance! 🎉

tim-janik commented 4 years ago

Change this line to

          if (!css || !css.length) {

This also fixes exceptions thrown during the packaging of some Vue components, which may have little or no css styles.