Munter / express-systemjs-translate

Express middleware to speed up systemjs development loads by running translations serverside
28 stars 4 forks source link

escape */ to *\/ in the inlined sourcemap to avoid ending the comment #182

Closed gustavnikolaj closed 8 years ago

gustavnikolaj commented 8 years ago

I had an application that stopped working whenever I added the debug flag in the middleware options.

Turned out it was because said source map included the string */ which would cause the browser to throw a SyntaxError when evaluating the prematurely closed comment.

SyntaxError: Unexpected token )

This is the problematic line: https://github.com/assetgraph/systemjs-asset-plugin/blob/master/asset-plugin.js#L58

My fix here breaks the regex that caused the problem, but I couldn't think of other ways to do this that wouldn't change the outcome. It could also be a comment in the inlined code.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 83.537% when pulling e6ec536ad8208a08fc3e652314d6981e5e08a26d on feature/escapeCommentsInDebugSourceMaps into 9e7fc1da813eaeca0499b4c472ce75633884b35d on master.

papandreou commented 8 years ago

How about using a single-line // ... comment instead?

Munter commented 8 years ago

I'm pretty printing the source map for debugging purposes, so there are newlines. Multiline comment is needed.