Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source map request return 500 when using MsieJavaScriptEngine #53

Closed
lijunle opened this issue Nov 25, 2014 · 9 comments
Closed

Source map request return 500 when using MsieJavaScriptEngine #53

lijunle opened this issue Nov 25, 2014 · 9 comments

Comments

@lijunle
Copy link

lijunle commented Nov 25, 2014

After long time investigation, the following statement returns different output in IE10 and IE11:

JSXTransformer.transform("var a = <span className=\"fuck\"/>", {sourceMap:true})

In IE11, which looks fine (notices that sourceMap object is generated):

{code: "var a = Rea...", extra: Object {...}, sourceMap: Object {...}, sourceMapFilename: "source.js"}

In IE10, suck... the sourceMap gone :(

{code: "var a = Rea...", extra: Object {...}}

When using MSIE JavaScript switcher in Json.Net, it is running in ChakraActiveScript mode, its document says ChakraJsRt mode leverage IE11. While I try with this way, but it does not work, still in ChakraActiveScript mode.

Any idea on this?


Besides, I think when send transformed JSX, it should check if it can generate source map before set the JSX header.

@Daniel15
Copy link
Member

This is expected, the older MSIE engine can't generate source maps. The source map code in JSXTransformer has this comment above it:

// The source-map library relies on Object.defineProperty, but IE8 doesn't
// support it fully even with es5-sham. Indeed, es5-sham's defineProperty
// throws when Object.prototype.__defineGetter__ is missing, so we skip building
// the source map in that case.

JSXHandler tries the best it can to generate source maps.

I had to intentionally disable ChakraJsRt since its stack size was too small to handle transforming JSX and it kept throwing stack overflow errors. You can try to re-enable it here: https://github.com/reactjs/React.NET/blob/master/src/React/AssemblyRegistration.cs#L44-54

Besides, I think when send transformed JSX, it should check if it can generate source map before set the JSX header.

This is a good idea, I could probably just do a basic check based on the current engine - Enable it for everything except MSIE.

@Daniel15
Copy link
Member

Also you can use the V8 engine (via React.JavaScriptEngine.ClearScriptV8 on Windows or React.JavaScriptEngine.VroomJs on Linux/Mac) which also supports source maps.

@lijunle
Copy link
Author

lijunle commented Nov 28, 2014

@Daniel15 thanks for you advise. I may change to V8 if it is great. Besides, I have sent a PR to disable source map if it is MSIE which I have tested locally. Please take a look.

@ashic
Copy link

ashic commented Dec 30, 2014

Is there a way to force V8 (or disabling sourcemaps for MSIE)? I couldn't find a way to specify the engine.

@domenu
Copy link

domenu commented Jan 7, 2015

Same here, getting HTTP 500 (Unable to generate source map) in chrome...

@Daniel15
Copy link
Member

Daniel15 commented Jan 8, 2015

@ashic Installing React.JavaScriptEngine.ClearScriptV8 should be sufficient to force V8.

@daniellmb
Copy link

Yep installing ClearScriptV8 fixed it for me...

@evenkiel
Copy link

+1. Installed React.JavaScriptEngine.ClearScriptV8 via nuget to my MVC project and the 500 errors went away. Thanks!

@Daniel15
Copy link
Member

Closing this out since V8 (ClearScript / VroomJs) is bundled by default now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants