expo / expo-webpack-integrations

Packages used to integrate Expo in Webpack-based projects.
8 stars 1 forks source link

@expo/webpack-config The 'compilation' argument must be an instance of Compilation #14

Open jmatsushita opened 1 year ago

jmatsushita commented 1 year ago

Summary

Running expo start --web even without a custom webpack config fails for me with The 'compilation' argument must be an instance of Compilation.

Pinning the webpack version using the yarn resolutions field makes the error disappear when using webpack@5.81.0 and reappear with any version above.

I'm in a monorepo using yarn workspaces

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.2.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.20.0 - /private/var/folders/00/g5w2j6ys0215bwf7qsjqqxw80000gn/T/xfs-214aff19/node
      Yarn: 4.0.0-rc.45 - /private/var/folders/00/g5w2j6ys0215bwf7qsjqqxw80000gn/T/xfs-214aff19/yarn
      npm: 8.19.4 - /nix/store/2js4vxscm74iwzgs3mmqpqpg2kkgwdfg-nodejs-16.20.0/bin/npm
      Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /Users/jun/.rbenv/shims/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.9971841
      Xcode: 14.3/14E222b - /nix/store/9bv5x7gw4xkm053z833gbj0wgpcsjwn4-xcode-wrapper-14.3/bin/xcodebuild
    Expo Workflow: managed

Please specify your device/emulator/simulator platform, model and version

web

Error output

Starting Metro Bundler
  expo:start:server:urlCreator URL: exp://192.168.2.101:19000 +0ms
  expo:start:server:developmentSession Development session ping (runtime: native, url: exp://192.168.2.101:19000) +0ms
  expo:api:fetch:base fetch: https://api.expo.dev/v2/development-sessions/notify-alive +0ms
  expo:utils:fileNotifier Observing ./platforms/client/metro.config.js +1s
  expo:start:server:devServer Stopping dev server (bundler: webpack) +891ms
  expo:start:server:devServer Stopped dev server (bundler: webpack) +0ms
  expo:start:server:devServer Stopping dev server (bundler: webpack) +9ms
  expo:start:server:devServer Stopped dev server (bundler: webpack) +0ms
  expo:start:server:webpack:devServer Starting webpack on port: 19006 +0ms
⚠️ Must set TAMAGUI_TARGET
⚠️ Must set TAMAGUI_TARGET
Starting Webpack on port 19006 in development mode.
  expo:start:server:developmentSession Development session ping (runtime: web, url: http://localhost:19006) +2s
  expo:api:fetch:base fetch: https://api.expo.dev/v2/development-sessions/notify-alive +2s
(node:25000) [DEP_WEBPACK_DEV_SERVER_CONSTRUCTOR] DeprecationWarning: Using 'compiler' as the first argument is deprecated. Please use 'options' as the first argument and 'compiler' as the second argument.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:25000) [DEP_WEBPACK_DEV_SERVER_LISTEN] DeprecationWarning: 'listen' is deprecated. Please use the async 'start' or 'startCallback' method.
./node_modules/@expo/webpack-config/node_modules/webpack/lib/NormalModule.js:230
                        throw new TypeError(
                        ^

TypeError: The 'compilation' argument must be an instance of Compilation
    at Function.getCompilationHooks (.node_modules/@expo/webpack-config/node_modules/webpack/lib/NormalModule.js:230:10)
    at .node_modules/@expo/webpack-config/node_modules/webpack-manifest-plugin/dist/index.js:58:42
    at _next36 (eval at create (.node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:50:1)
    at _next14 (eval at create (.node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
    at Hook.eval [as call] (eval at create (.node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:129:1)
    at Hook.CALL_DELEGATE [as _call] (.node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (.node_modules/webpack/lib/Compiler.js:1125:26)
    at .node_modules/webpack/lib/Compiler.js:1169:29
    at Hook.eval [as callAsync] (eval at create (.node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (.node_modules/tapable/lib/Hook.js:18:14)

Reproducible demo or steps to reproduce from a blank project

Not sure how to reproduce but I've seen the error reported elsewhere: