During conversations with @adamraya I uncovered an issue in bundling our Application Extensions in the PWA-Kit app. The problem stems from the fact that we build the application on the the local developers environment before shipping the pre-built artifact to MRT. This means that we don't know what environment this code will be run on.
This poses a problem because the configured extensions during the build time might be different than the ones required for runtime. For example, I build the code on my local environment and it uses the configuration file, default.js which has app extension A, and B installed and configured. I then push my code to the production environment which has its own configuration file, production.js. This configuration file has app extensions B and C configured.
What happens is that the app extension C will never be loaded as it was never included in the bundle.
The solution (for now) is to ensure that all Application Extensions are bundled during build, we do this by ensuring all the extensions that are installed (in the dev-dependencies list) are imported. But only those that are configured at returned via a new getExtensions function that is exported in the extensions.js file.
NOTE: I have added another Application Extension project in the repo for testing purposes, this will be deleted before merging the code.
NOTE: We will most certainly want to investigate dynamic loading of app extensions for the front end. The reason being is that for large large projects that want to have almost mutually exclusive application extension configurations per configuration will end up with lost of unused code in their bundle. We can solve this with dynamic extension loading.
Types of Changes
[x] Bug fix (non-breaking change that fixes an issue)
[ ] New feature (non-breaking change that adds functionality)
[ ] Documentation update
[ ] Breaking change (could cause existing functionality to not work as expected)
[ ] Other changes (non-breaking changes that does not fit any of the above)
Changes
Ensure all installed extensions are bundled in code.
How to Test-Drive This PR
Checklists
General
[ ] Changes are covered by test cases
[ ] CHANGELOG.md updated with a short description of changes (not required for documentation updates)
Accessibility Compliance
You must check off all items in one of the follow two lists:
[ ] There are no changes to UI
or...
[ ] Changes were tested with a Screen Reader (iOS VoiceOver or Android Talkback) and had no issues
Description
During conversations with @adamraya I uncovered an issue in bundling our Application Extensions in the PWA-Kit app. The problem stems from the fact that we build the application on the the local developers environment before shipping the pre-built artifact to MRT. This means that we don't know what environment this code will be run on.
This poses a problem because the configured extensions during the build time might be different than the ones required for runtime. For example, I build the code on my local environment and it uses the configuration file,
default.js
which has app extension A, and B installed and configured. I then push my code to the production environment which has its own configuration file,production.js
. This configuration file has app extensions B and C configured.What happens is that the app extension C will never be loaded as it was never included in the bundle.
The solution (for now) is to ensure that all Application Extensions are bundled during build, we do this by ensuring all the extensions that are installed (in the dev-dependencies list) are imported. But only those that are configured at returned via a new
getExtensions
function that is exported in theextensions.js
file.NOTE: I have added another Application Extension project in the repo for testing purposes, this will be deleted before merging the code.
NOTE: We will most certainly want to investigate dynamic loading of app extensions for the front end. The reason being is that for large large projects that want to have almost mutually exclusive application extension configurations per configuration will end up with lost of unused code in their bundle. We can solve this with dynamic extension loading.
Types of Changes
Changes
How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization