axeldelafosse / expo-next-monorepo-example

Create a universal React app using Expo and Next.js in a monorepo

Home Page:https://expo-next-monorepo-example.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete yarn.lock and then run yarn install. The next.js would fail to run...

iam-yan opened this issue · comments

commented

Reproduce:

  1. Download the repo
  2. Delete yarn.lock
  3. run yarn
  4. run the next app, i.e. yarn dev:next

I got the following error:

info  - automatically enabled Fast Refresh for 1 custom loader
info  - Using external babel configuration from /.../packages/next/.babelrc.json
info  - automatically enabled Fast Refresh for 1 custom loader
HookWebpackError: Cannot read properties of undefined (reading 'replace')
    at makeWebpackError (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:41664:9)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25354:12
    at eval (eval at create (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140346:10), <anonymous>:12:1)
    at fn (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:22775:17)
    at Hook.eval [as callAsync] (eval at create (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140346:10), <anonymous>:10:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140148:14)
    at cont (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25351:34)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25399:10
    at symbolIterator (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14443)
    at done (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14823)
-- inner error --
TypeError: Cannot read properties of undefined (reading 'replace')
    at PagesManifestPlugin.createAssets (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.js:35:47)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.js:47:22
    at fn (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:22773:10)
    at Hook.eval [as callAsync] (eval at create (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140346:10), <anonymous>:10:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140148:14)
    at cont (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25351:34)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25399:10
    at symbolIterator (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14443)
    at done (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14823)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:9429
caused by plugins in Compilation.hooks.processAssets
TypeError: Cannot read properties of undefined (reading 'replace')
    at PagesManifestPlugin.createAssets (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.js:35:47)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.js:47:22
    at fn (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:22773:10)
    at Hook.eval [as callAsync] (eval at create (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140346:10), <anonymous>:10:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:140148:14)
    at cont (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25351:34)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/webpack/bundle5.js:25399:10
    at symbolIterator (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14443)
    at done (/Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:14823)
    at /Users/yanzhu/Documents/Project/study/js/playgrounds/test/node_modules/next/dist/compiled/neo-async/async.js:1:9429

PS: The line info - automatically enabled Fast Refresh for 1 custom loader has come out twice...

What could be wrong here?

Same here

Add webpack5: true, in this config object https://github.com/axeldelafosse/expo-next-monorepo-example/blob/main/packages/next/next.config.js#L14. This seems to be an issue with @expo/next-adapter expo/expo-cli#4066

Looks to be a regression in the webpack5 checking logic within Expo, with it now defaulting to webpack 4. The workaround is explicating setting webpack5: true in your next.config.js

See: expo/expo-cli#4066 (comment)

commented

@rmylagary Yeah true. I have just noticed this issue...expo/expo-cli#4195 (comment)

This repo is now deprecated in favour of Solito