nds-org / workbench-webui

Web UI for the Workbench platform
0 stars 1 forks source link

fix: upgrade to NodeJS 18 / React 18 / Router v6, pin to Typescript 4.5.2 #12

Closed bodom0015 closed 1 year ago

bodom0015 commented 1 year ago

Problem

yarn build fails with an error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /app/workbench-webui/node_modules/postcss-safe-parser/node_modules/postcss/package.json
    at new NodeError (node:internal/errors:372:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:719:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/workbench-webui/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Approach

NodeJS 18 is the newest LTS, and we need to support it to stay current with build tools, base images, etc

React 17 and prior versions of webpack (v4?) that are used by react-scripts do not support some of the new features of Node 18, so we'll need to upgrade some other things to get everything back to a state where it builds

This, in tandem with the new build actions for running yarn build should notify us a bit earlier when these things break

How to Test

Prerequisite: using NodeJS 18 (LTS)

  1. Checkout and run this branch locally
  2. yarn install
  3. yarn swagger
  4. yarn build

If all of these complete successfully, then the issue is resolved