Shared code & assets between app and plugin is great ✨ -- testing builds of the PWA example app with a plugin between master and this branch, the total build size is now less than half
App and plugin are conceptually separated more in the CLI -- it's now easier to build a plugin without building an app
Smaller cache size when developing a PWA app locally -- this was actually a problem with the webpack dev server too
Changes made:
Vite config moved a file in shell to a function in the CLI to be more dynamic based on config. Requires Node API; used dynamic import and MJS
Moved Vite deps to CLI from shell
No longer need to execute ‘start’ and ‘build’ scripts in shell dir to make things happen
Changed up Env handling a bit; need to do some more manual string replacement on things that were previously added to env via the CLI
Added dynamic inputs to build process (don’t need it for the dev server; Vite just fires up everything in the root dir)
Apps and plugins are now handled in the same process; don’t need two scripts
Fixed up ‘deploy’ script for plugin without an app
Changed up config validation & build process a bit to make it easier to handle plugins without apps
Removed need for ‘getOriginalEntrypoints’ to tell if something actually has an app entrypoint defined or not
Service worker
Don’t need plugin precache manifest (it’s part of the rest)
Added a special “Dev Network First” caching strategy to "hit two flies in one swing": avoid "cache bloat" from constantly updating source files with new version hashes, and enable going offline immediately after HMR updates (long story)
Shell plugin files updated
Refactored dynamic import — I forget exactly what was happening, but I think if an app was built without a plugin, the plugin HTML still tried to find that entry point but it wouldn't exist after the App replaced it
Since app and plugin now run on the same script and have the same env vars, needed a new way to determine the ‘IS_PLUGIN’ var -- I chose to do a string replacement at bootstrapping time, which helps with dead code elimination (apps can drop all the plugin stuff). I used self.__IS_PLUGIN as the replacement target to distinguish it from other vars that are being populated from the env (kinda)
LIBS-610
Accomplishes some nice things:
master
and this branch, the total build size is now less than halfChanges made:
self.__IS_PLUGIN
as the replacement target to distinguish it from other vars that are being populated from the env (kinda)