Glavin001/atom-preview

EvalError generating Jade preview

PyroSA opened this issue · 11 comments

I'm getting an error while generating Jade previews. Coffeescript works fine.

Atom: 0.187.0
Preview: 0.13.5
Runnning in Windows 8.1 x64

The error is as follows:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

Previewing Failed…

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
 at Function (native)
 at makePredicate (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:508:12)
 at C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:513:25
 at exports.version (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:25:71)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:28:3)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\index.js:3:13)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\index.js:3:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\parser.js:8:22)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\index.js:13:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.module.exports.grammars.Jade.render (C:\Users\-snip-\.atom\packages\preview\lib\renderer.coffee:95:16)
 at atom-preview-editor.PreviewView.renderPreviewWithRenderer (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:347:27)
 at atom-preview-editor.PreviewView.renderPreview (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:229:6)
 at later (C:\Users\-snip-\.atom\packages\preview\node_modules\underscore-plus\node_modules\underscore\underscore.js:724:25)

I was unable to reproduce this.

However I have implemented the code that would fix this.

Let me know if it works.

Published to v0.13.7

Error still seems to be exactly the same in v0.13.7

I've got the exact same error on v0.13.7 on OS X

Same error with atom 0.188.0 & preview v0.13.7 on Linux

Bummer. I'll try to find some time this weekend to debug. I am unable to reproduce and the changes I made with 530a425 should have resolved it even if I was not experiencing the issue. I'll keep looking into it. Thanks for letting me know that you are also experiencing this issue.

I am now able to reproduce: I unlinked my development copy of Atom Preview and installed a fresh copy of Atom Preview with apm. Working on resolving this now.

Published to v0.13.8

Awesome, works like a charm 👍

Great! Thanks for confirming that it is working for you. Let me know if there's anything else.

Working for me as well!

Thanks 👍