Testing Mirador using React 17 #3768
Pinned
phil-plencner-hl
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The recent commits to the
master
branch of Mirador include upgrades to React 17 (as part of this closed issue: #3601) .There has not been a tagged release with these changes yet. However, in an effort to test out the functionality with Harvard's new Viewer which leverages Mirador 3 I have created an instance of the Harvard Viewer on Github Pages using Mirador 3 and React 17. You can see a set of example objects that use that instance here:
https://harvard-lts.github.io/mps-viewer/gh-pages/
The branch in our repository which includes this work is here:
https://github.com/harvard-lts/mps-viewer/tree/pre-pre-release
What were the steps I took to get to this state?
mirador
usingnpm uninstall mirador
react
andreact-dom
to version 17 usingnpm install [email protected] [email protected]
mirador
on themaster
branch using the tarball url (See: https://www.pluralsight.com/guides/install-npm-packages-from-gitgithub) usingnpm install https://github.com/ProjectMirador/mirador/tarball/master
src/mirador.js
: https://github.com/harvard-lts/mps-viewer/blob/pre-pre-release/src/mirador.js#L1C1-L9 and https://github.com/harvard-lts/mps-viewer/blob/pre-pre-release/src/mirador.js#L339-L347babel-plugin-react-html-attr
dev-dependency
and added a.babelrc
file (https://github.com/harvard-lts/mps-viewer/blob/pre-pre-release/.babelrc) to squash invalid DOM property warnings usingnpm install --save-dev babel-plugin-react-html-attr
mirador
is installed via the tarball it is not built. So I had to runnpm install
andnpm run prepublishOnly
under the/node_modules/mirador/
folder for Webpack to successfully build. I added it as apostinstall
script to package.json. (See: https://stackoverflow.com/a/39307622): https://github.com/harvard-lts/mps-viewer/blob/pre-pre-release/package.json#L18jsx-runtime
. The temporary fix is to add aliases to webpack.config.js. I believe this can be removed when we upgrade to React 18. (Discovered here: Bug: Cannot import 'react/jsx-runtime' from esm node/webpack 5 facebook/react#20235 (comment)): https://github.com/harvard-lts/mps-viewer/blob/pre-pre-release/webpack/webpack.config.js#L33-L38What needs to happen next?
mirador
so we no longer need to build off of a tarball and build it manually in apostinstall
script.I encourage any thoughts, feedback or collaboration on this effort.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions