Just updated to Expo 47 from Expo 46, but the web app stopped working

  1. SDK Version: 47
  2. Platforms(Android/iOS/web/all): web

I am on a monorepo

$ expo start --web -c
Starting project at C:\p\spring-docker\expo-app
Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
Clearing Webpack development cache directory...
Starting Webpack on port 19006 in development mode.
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.node should be one of these:
   false | object { __dirname?, __filename?, global? }
   -> Include polyfills or mocks for various node stuff.
   Details:
    * configuration.node has an unknown property 'module'. These properties are valid:
      object { __dirname?, __filename?, global? }

I tried to remove the webpack.config.js as well same error (but I do need it because I have to transpile stuff in the mono-repo

const createExpoWebpackConfigAsync = require("@expo/webpack-config");

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: ["@trajano"],
      },
    },
    argv
  );
  // Customize the config before returning it.
  return config;
};
❯ yarn why webpack
yarn why v1.22.19
[1/4] Why do we have the module "webpack"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "webpack@4.43.0"
info Reasons this module exists
   - "_project_#@trajano#spring-docker-expo-app#@expo#webpack-config" depends on it
   - Hoisted from "_project_#@trajano#spring-docker-expo-app#@expo#webpack-config#webpack"

Still not working even reverting back to 46 didn’t work. So it may be one of those errors that are caused by upstream. Expo 45 build fail on Android with EAS - #3 by ksi9302. Since this was my play around experiment I didn’t have a proper older lock file to revert to (since I don’t normally use expo web for work)

Anyway what I found so far is that the version of webpack that gets installed is actually not the correct one, it loads 5 rather than 4.x. To mitigate that I had to add webpack as a devDependency on the app so the root node_modules would load up the correct one.

Try running npm why webpack (yes, even though you are using yarn to manage your dependencies)

Thanks for the tip, I didn’t know npm had why now.

I did eventually find the cause was my own 3rd party package which uses create-react-library and uses react-scripts@5 which has a dependency among other things the webpack.

Since that library was meant to be stand alone no react-native or expo dependency, I was expecting it to just work as is but seems like that hypothesis didn’t stand.

Then again I am still learning how to do monorepos.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.