-
Notifications
You must be signed in to change notification settings - Fork 365
Webpack
Trying to document the usual problems people have with our webpack, and ways of fixing them.
compile the UI code + plugins:
bin/update - it all happens automatically during bin/update, but maybe that's not enough
rake update:ui - runs yarn in all the repositories, and then webpack
bin/webpack - (in ui-classic) runs just the webpack part
bin/webpack --watch - runs webpack and keeps watching for changes
rake webpack:clobber - clear all webpack compiled code
rake yarn:clobber - clear installed npm packages from all repos - usually needed after Fedora upgrade
Webpack doesn't just compile ui-classic code, it also compiles code from all rails plugins.
Specifically, rake webpack:paths generates a manageiq-ui-classic/config/webpack/paths.json containing paths to each gem with a package.json and app/javascript, and the output path to manageiq/public.
Webpack then reads that paths.json file to find all the sources and output path.
(You can use rake update:print_engines to see the list of relevant UI engines.)
Packs are just webpack entrypoints. In manageiq we have several packs:
- loaded as part of
javascript_essential_dependencies:-
runtime- just the webpack runtime -
shims- various shims to support older browsers (may go away) -
vendor- everything we use from node_modules, possibly other code shared betweeen multiple packs
-
- loaded as part of
javascript_dependencies- after essential, before old JS-
manageiq-ui-classic/globals.js- most external libraries we're using as globals
-
- loaded via
javascript_common_packs- anything in ANY repo, named
app/javascript/packs/*-common.js(ui-classic repo goes first, application-common goes first from ui-classic)
- anything in ANY repo, named
- loaded manually via
javascript_pack_tag- anything under
app/javascript/packs/in any repo, without the-common.jssuffix - never loaded automatically, always needs an explicitjavascript_pack_tagin a haml
- anything under
All the compiled packs end up in manageiq/public/packs/(repo_name)/(pack_name).(hash).js