expo / expo-webpack-integrations

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

ValidationError: Invalid configuration object. using @expo/electron-adapter #15

Open danivegamx opened 1 year ago

danivegamx commented 1 year ago

Summary

Running yarn expo-electron start as per this tutorial, a validation error in webpack config is happening. Specially with 'namedModules'. This is related to webpack version (tutorial has webpack 4) but there's some other version impacting this?

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.4 Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /opt/homebrew/bin/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.1/14E300c - /usr/bin/xcodebuild npmPackages: @expo/metro-config: ^0.7.1 => 0.7.1 @expo/webpack-config: ^18.0.4 => 18.1.0 expo: ~48.0.17 => 48.0.19 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-web: ~0.18.10 => 0.18.12 npmGlobalPackages: expo-cli: 6.3.9 Expo Workflow: managed

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

Desktop

Error output

ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.

┗ ---------------------------- Renderer WDS exited with code 1

Reproducible demo or steps to reproduce from a blank project

Using existing expo project with no expo-electron configuration or using a new expo project (using expo init)

  1. run yarn add -D @expo/electron-adapter
  2. run yarn expo-electron
  3. you should see the output
danivegamx commented 1 year ago

Doing some workarounds, I was able to run without webpack version errors but the adapter is not working at all. Renderer shows multiple errors like:

┏ Renderer -------------------

  <w> [webpack-dev-server] "hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.

┗ ----------------------------
┏ Renderer -------------------

  (node:73508) [DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS] DeprecationWarning: optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors
  (Use `node --trace-deprecation ...` to show where the warning was created)

┗ ----------------------------
┏ Renderer -------------------

  (node:73508) [DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)

┗ ----------------------------
┏ Renderer -------------------

  (node:73508) [DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)

┗ ----------------------------
┏ Renderer -------------------

  (node:73508) [DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK] DeprecationWarning: MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)

┗ ----------------------------
┏ Renderer -------------------

  <e> [webpack-dev-middleware] TypeError: utils_1.resolveEntryAsync is not a function
  <e>     at config.entry (/Users/danvega/Animus/mlf-app/node_modules/@expo/electron-adapter/src/Webpack.ts:71:29)
  <e>     at processTicksAndRejections (node:internal/process/task_queues:95:5)

┗ ----------------------------
┏ Renderer -------------------

  <i> [webpack-dev-server] Project is running at:

┗ ----------------------------
┏ Renderer -------------------

  <i> [webpack-dev-server] Loopback: http://localhost:9080/, http://[::1]:9080/
  <i> [webpack-dev-server] Content not from webpack is served from '/Users/danvega/Animus/mlf-app/public' directory

┗ ----------------------------

after that, nothing happens