With ManageIQ/manageiq-ui-classic#1132, we’re introducing webpack (version 3) into the UI mix, via webpacker. This means we can now use new Javascript, and even Typescript in ui-classic (but read on, not everywhere).
Webpack is a tool to compile our frontend dependencies into one or more bundles.
Webpacker is a rails project, handling the integration of webpack into rails, including helpers like javascript_pack_tag
, etc.
Code living under app/assets/javascripts/
should not be affected by this change and will continue to work as before, using sprockets and rails’ asset pipeline. But, for new code, this is no longer the right place, newly written code should live under app/javascript/
, and will be compiled via webpacker.
Non-UI devels:
Unless you’re doing UI changes, this should be a no-op for you, as long as you run bin/update
after updating ui-classic, or changing branches there, you should be fine - /bin/update
calls rake update:ui
.
rake update:ui
now not only installs bower & yarn dependencies, it also recompiles these UI assets.
UI devs:
No changes in app/javascript/
will be visible in the UI before you compile them.
This can be done manually, by running rake webpack:compile
, or it can happen automatically on any change, as long as you’re running bin/webpack --watch
from ui-classic.
So… please make sure you’re always running bin/webpack --watch
when doing UI changes (from ui-classic). You will also need to run the rake task at least once, or any time you add/remove a UI plugin.
Rails engines:
Webpacker itself doesn’t support rails engines, we have a rake webpack:paths
task which creates an config/webpack/paths.json
config file, with the paths to all the engines, including ManageIQ for output.
Right now, any Rails engine with an app/javascript
will get compiled (and yarn
will be called in it), later, this may apply only to plugins which explicitly ask for it.
For more details, please go to https://github.com/ManageIQ/manageiq-ui-classic/pull/1132 .