Most of our repositories are currently using Node v8 or v12. As node v8’s support ended on 31st December 2019 and node v12’s support is scheduled to end on 30th April 2022, we’re going to start upgrading our repositories to node v16.
...
(we’ll consider adding a modernizer to automate this phase as well but as of now it’s going to be a manual step taken by the owning team).
If applicable, please update the status in this sheet as well Node 16 upgrade status tracking
Steps to deploy an MFE on Node 16:
...
node15 has started generating failures instead of warnings on unhandled promise rejections. You may find tests are going to fail for what used to be warnings before. e.g.,, this PR fixes a few warnings that failed tests with node16: https://github.com/openedx/frontend-app-enterprise-public-catalog/pull/199
if you happen to need to upgrade jest (you may very well need to, to v25) then note that your tests may start failing if they use. See this for details: https://github.com/openedx/paragon/pull/1068/files#r816561658
Jest v25 uses jsdom v15 (link) and all the tests related to focus started to fail due to the changes introduced in jsdom v15 (link). You may need to apply a fix to use attachTo in order to fix this issue following these references link1, link2. Reference PR
if you upgrade to a newer edx/eslint-config version (which is now using node16), you may also need to fix eslint issues such as this reference PR
Helpful local testing notes for testing out enterprise repos against node 16
In case someone decides to try this, here are the tailored node ‘tryout’ instructions. I can move this to a doc if that works better. Consulted with @astankiewicz before sending this out
Install
nvm
locally (you can use other node manages too this is just what I use)Sync this branch of frontend-enterprise with Adam’s fixes: https://github.com/openedx/frontend-enterprise/pull/250
Start completely clean, remove node_modules/, package-lock file (it will all need to be regenerated)
update .nvmrc file to v16 if not already
nvm use
(nvm will ask to install node16 if not already on your system)Verify node is now 16 and npm is v8
Code Block |
---|
node -v; npm -v |
npm run clean; npm run setup; npm run build
All set with frontend-enterprise prep
MFE
For MFE: keep what you have, do not upgrade node:
Ensure node version by
node -v
andnpm -v
is what you used to have.Create/update module.config.js file with the necessary changes such as this (for learner portal)
Code Block |
---|
{ moduleName: '@edx/frontend-enterprise-catalog-search', dir: '../frontend-enterprise/packages/catalog-search', dist: 'src' },
{ moduleName: '@edx/frontend-enterprise-utils', dir: '../frontend-enterprise/packages/utils', dist: 'src' }, |
Note: using
dist: 'src'
mean you will get hot reload without having to rebuild frontend-enterprise all the timeStart app. If already running, you first need to ctrl+c to pick up the module.config changes
Test the app!
There you go, this is what I think needs to be done. I will be doing this myself, but this is for adventurous souls to explore as they wish!