I’ve had this compiling error for several days. Even in projects without React. So I tried reproduce this error on original sage template and this was easier than I think, just copy and paste bud modules from project to sage template.
  ERROR  Cannot read properties of null (reading 'useState')
 node_modules/@roots/bud-support/node_modules/react/cjs/react.development.js:1622:21
 1619: }
 1620: function useState(initialState) {
 1621:   var dispatcher = resolveDispatcher();
 1622:   return dispatcher.useState(initialState);
 1623: }
 1624: function useReducer(reducer, initialArg, init) {
 1625:   var dispatcher = resolveDispatcher();
 - useState (node_modules/@roots/bud-support/node_modules/react/cjs/react.development.js:1622:21)
 - Compilation (file:///Users/marcinlis/Downloads/sage-main%202/node_modules/@roots/bud-dashboard/lib/views/compilation.js:12:35)
 - renderWithHooks (node_modules/react-reconciler/cjs/react-reconciler.development.js:6659:18)
 - mountIndeterminateComponent (node_modules/react-reconciler/cjs/react-reconciler.development.js:11276:13)
 - beginWork (node_modules/react-reconciler/cjs/react-reconciler.development.js:12799:16)
 - beginWork$1 (node_modules/react-reconciler/cjs/react-reconciler.development.js:19608:14)
 - performUnitOfWork (node_modules/react-reconciler/cjs/react-reconciler.development.js:18742:12)
 - workLoopSync (node_modules/react-reconciler/cjs/react-reconciler.development.js:18648:5)
 - renderRootSync (node_modules/react-reconciler/cjs/react-reconciler.development.js:18616:7)
 - performSyncWorkOnRoot (node_modules/react-reconciler/cjs/react-reconciler.development.js:18232:20)
Steps to reproduce:
- Use sage template from repo
- Remove yarn.lock
- Change dev dependcies to:
"devDependencies": {
    "@roots/bud": "6.21.0",
    "@roots/bud-eslint": "6.21.0",
    "@roots/bud-imagemin": "6.21.0",
    "@roots/bud-postcss": "6.21.0",
    "@roots/bud-prettier": "6.21.0",
    "@roots/bud-sass": "6.21.0",
    "@roots/bud-stylelint": "6.21.0",
    "@roots/bud-swc": "6.21.0",
    "@roots/bud-tailwindcss": "6.21.0",
    "@roots/eslint-config": "6.21.0",
    "@roots/sage": "6.21.0"
  }
- Just run npm installandnpm run build
- Got the error
The problem also occurs on version 6.20.0, with which I had no problems for a long time.
I will be grateful if you fix the problem.
