This PR makes all Runestone Components dynamically loaded. The basic approach:
When the document is ready, search for all HTML entities with a data-component attribute (which only occurs for the Runestone components). Use the value of this attribute (which is the name of the Runestone component) to dynamically load code for that component.
In bookfuncs.js, send a "pre-login-complete" trigger/event instead of the "login-complete" event.
In webpack.index.js, delay the runestone:login-complete trigger/event until dynamic loads are done and the "pre-login-complete" event has triggered.
In renderComponent.js, when rendering a component, import its JS first.
I upgraded to webpack 5, so be sure to run a npm install then a npm run build to update everything when testing.
This PR makes all Runestone Components dynamically loaded. The basic approach:
data-component
attribute (which only occurs for the Runestone components). Use the value of this attribute (which is the name of the Runestone component) to dynamically load code for that component.bookfuncs.js
, send a "pre-login-complete" trigger/event instead of the "login-complete" event.webpack.index.js
, delay therunestone:login-complete
trigger/event until dynamic loads are done and the "pre-login-complete" event has triggered.renderComponent.js
, when rendering a component, import its JS first.I upgraded to webpack 5, so be sure to run a
npm install
then anpm run build
to update everything when testing.