payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.64k stars 1.56k forks source link

payload@1.8.0: webpack doesn't compile when running `pnpm dev` #2649

Closed klapec closed 1 year ago

klapec commented 1 year ago

Link to reproduction

https://github.com/klapec/payload-1.8-pnpm-repro

To Reproduce

  1. Clone the reproduction repository
  2. Run pnpm i to install dependencies
  3. Run pnpm dev

Describe the Bug

Payload's admin panel doesn't show up because webpack is unable to compile the assets. Here's the output (visible in both terminal and the browser):

long terminal output
❯ pnpm dev > pnpm-payload-test@1.0.0 dev /Volumes/dev/repos/pnpm-payload-test > cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon [nodemon] 2.0.6 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: ts [nodemon] starting `ts-node src/server.ts` [20:54:43] INFO (payload): Connected to Mongo server successfully! [20:54:43] INFO (payload): Starting Payload... [20:54:44] INFO (payload): Payload Admin URL: http://localhost:3000/admin webpack built ddea6ebb660c38f239d3 in 1026ms ERROR in ./node_modules/.pnpm/@dnd-kit+accessibility@3.0.1_react@18.2.0/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js 1:0-53 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@dnd-kit+accessibility@3.0.1_react@18.2.0/node_modules/@dnd-kit/accessibility/dist' ERROR in ./node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.2.0_react@18.2.0/node_modules/@dnd-kit/core/dist/core.esm.js 1:0-152 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.2.0_react@18.2.0/node_modules/@dnd-kit/core/dist' ERROR in ./node_modules/.pnpm/@dnd-kit+sortable@7.0.2_@dnd-kit+core@6.0.8_react@18.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.js 1:0-80 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@dnd-kit+sortable@7.0.2_@dnd-kit+core@6.0.8_react@18.2.0/node_modules/@dnd-kit/sortable/dist' ERROR in ./node_modules/.pnpm/@dnd-kit+utilities@3.2.1_react@18.2.0/node_modules/@dnd-kit/utilities/dist/utilities.esm.js 1:0-81 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@dnd-kit+utilities@3.2.1_react@18.2.0/node_modules/@dnd-kit/utilities/dist' ERROR in ./node_modules/.pnpm/@emotion+core@10.3.1_react@18.2.0/node_modules/@emotion/core/dist/core.browser.esm.js 2:0-59 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@emotion+core@10.3.1_react@18.2.0/node_modules/@emotion/core/dist' ERROR in ./node_modules/.pnpm/@emotion+core@10.3.1_react@18.2.0/node_modules/@emotion/core/dist/emotion-element-04d85134.browser.esm.js 2:0-75 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@emotion+core@10.3.1_react@18.2.0/node_modules/@emotion/core/dist' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/Modal/index.js 29:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/Modal' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalContainer/index.js 29:30-46 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalContainer' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalProvider/context.js 4:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalProvider/index.js 40:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalToggler/index.js 29:30-46 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/ModalToggler' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/asModal/index.js 52:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/asModal' ERROR in ./node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/useModal/index.js 6:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+modal@2.0.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/modal/dist/useModal' ERROR in ./node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfo/index.js 29:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfo' ERROR in ./node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfoProvider/context.js 3:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfoProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfoProvider/index.js 40:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/ScrollInfoProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/useScrollInfo/index.js 6:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/useScrollInfo' ERROR in ./node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/withScrollInfo/index.js 17:30-46 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+scroll-info@1.3.0_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/scroll-info/dist/withScrollInfo' ERROR in ./node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfo/index.js 29:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfo' ERROR in ./node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfoProvider/context.js 3:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfoProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfoProvider/index.js 40:27-43 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/WindowInfoProvider' ERROR in ./node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/useWindowInfo/index.js 6:14-30 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/useWindowInfo' ERROR in ./node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/withWindowInfo/index.js 17:30-46 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/@faceless-ui+window-info@2.1.1_react-dom@18.2.0_react@18.2.0/node_modules/@faceless-ui/window-info/dist/withWindowInfo' ERROR in ./node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/Root.js 10:32-48 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin' ERROR in ./node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/Routes.js 29:29-45 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components' ERROR in ./node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/ArrayAction/index.js 7:32-48 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/ArrayAction' ERROR in ./node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/Autosave/index.js 31:29-45 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/Autosave' ERROR in ./node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/Banner/index.js 7:32-48 Module not found: Error: Can't resolve 'react' in '/Volumes/dev/repos/pnpm-payload-test/node_modules/.pnpm/payload@1.8.0_monaco-editor@0.38.0_scheduler@0.23.0_typescript@4.8.4/node_modules/payload/dist/admin/components/elements/Banner' (...) cut because of github's characters limit webpack compiled with 352 errors

Payload Version

1.8.0

klapec commented 1 year ago

I should add that this repro repository was just scaffolded with pnpx create-payload-app, nothing was modified except for running pnpm i (which added the pnpm lockfile) and removing yarn.lock.

klapec commented 1 year ago

Oh and adding react as a dependency in package.json doesn't solve it unfortunately. I can confirm that the regression started in payload@1.8.0 as 1.7.5 seems to work just fine.

klapec commented 1 year ago

Looks like this could be the culprit here? https://github.com/payloadcms/payload/commit/733ca324d25b0865f7bc2a76fe31b1eebc4ba110

rzeczkowskip commented 1 year ago

I can confirm that it's not just pnpm issue. Same happens when using yarn

DanRibbens commented 1 year ago

We're on it! Thanks for reporting and confirming. Standby!

DanRibbens commented 1 year ago

Fixed in v1.8.2.

We had some other changes in the pipeline so sorry for the version blitz! Haha.

Please let me know if you still have any trouble.

klapec commented 1 year ago

Yup, all good now. Thanks Dan!

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.