Generate and deliver source maps for the admin UI assets

Description

Modern browser development tools are amazing, but they are almost impossible to use with the miinified JavaScript and CSS assets the admin UI delivers. Of course minification is important for performance, but the ability to properly debug is not to be discounted, either.

Fortunately, there is this thing called a "source map" that most JavaScript and CSS source transformation tools and transpilers can generate these days, which gives the browser a mapping from the minified code back to the original sources, so that it can for example display these in the debugger tab of the browser developer tools, and even let you step through it and look at the variables currently in scope.

Activity

Show:
Sven Stauber
March 19, 2018, 12:42 PM
Edited

Hi Julian, just as a comment: I would expect Admin UI developers to use the "Live working with a running Opencast" facility (see https://docs.opencast.org/develop/developer/modules/admin-ui/development/#live-working-with-a-running-opencast)
to avoid compilation completely (remember: JavaScript is an interpreted language that does not require compilation at all)

When working that way, the JavaScript code is not minified.

Doesn't mean the source maps are useless, but in case you really compiled the module "admin-ui" when working on the JavaScript code just for testing/debugging purposes: That is really not the way how to efficiently develop the Admin UI.

Julian Kniephoff
March 19, 2018, 1:05 PM

I see what you're saying, but I have to respectfully disagree with a few points. No hard feelings, though!

First, "being interpreted" is nothing that is really inherent in JavaScript the language. Sure, all of our code can be interpreted by most modern (...?) browsers, but large parts of the modern web development ecosystem *rely* on compilation (or rather transpilation, but who's to say that in a few years time we are not going to compile all of our JS to WASM?) and we should be prepared for that, IMO.

For the stylesheets this is *already* true for the Opencast codebase. No browser can interpret Sass.

And last but not least there is this passage from the page you cited:

"Be warned that some functionality in this live setup can be limited. Before reporting an issue, please test if you can reproduced the issue with a built Opencast."

And for me specifically these limitations manifested in the form of crashes after a few clicks. Which might be my fault, I'll admit, but still: All in all I still think we need sourcemaps.

Assignee

Julian Kniephoff

Reporter

Julian Kniephoff

Tags (folksonomy)

Components

Priority

Minor
Configure