You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using sass to compile sass/scss code in the runtime in electron application. When the page is loading, the follow error occurred:
TypeError: Illegal invocation
at Object.eval (sass.dart.js?eaa0:57)
at eval (sass.dart.js:90708)
at Object../node_modules/sass/sass.dart.js (vendor.js:23281)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at eval (web.vue?94bf:131)
at Module../node_modules/ts-loader/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/compileSass.vue?vue&type=script&lang=ts& (0.js:296)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at eval (compileSass.vue?625c:1)
This is my code:
// import sass from 'sass/sass.dart';importsassfrom'sass';//version 1functionrenderScss(code:string,type:'sass'|'scss'='scss'){try{//if I common this two line, the error disappersconstres=sass.renderSync({data:code,indentedSyntax:type==='sass'});return(res.css.toString());}catch(e){returne;//show err info}}//version 2, use promisefunctionrenderScss2(code:string,type:'sass'|'scss'='scss'){returnnewPromise((resolve,reject)=>{try{//if I common this two line, the error disappersconstres=sass.renderSync({data:code,indentedSyntax:type==='sass'});resolve(res.css.toString());// tried this , got the same error// sass.render( // {data:code, indentedSyntax:type ==='sass'}, // (err, res) => err ? reject(err) : resolve(res.css.toString())// );}catch(e){reject(e)}})}
I don't know where is the problem.
The text was updated successfully, but these errors were encountered:
How is renderScss actually being called? I can't replicate the error just by calling it from within Node.
You mention Electron. Is Sass running within the Node part of the app or within the browser part? Sass depends on the filesystem, so it can't actually run in a browser (see #25).
I'm using sass to compile sass/scss code in the runtime in electron application. When the page is loading, the follow error occurred:
This is my code:
I don't know where is the problem.
The text was updated successfully, but these errors were encountered: