Evan Bacon

With Expo SDK 50 we are officially deprecating support for using Webpack to bundle websites in Expo CLI. The recommended way to build websites is with Expo Router, which bundles using our universal implementation of Metro bundler. Please take a look at our documentation to learn more about migrating from Expo Webpack to Expo Router.

You can also use Metro for web without Expo Router, but file-based features like API Routes and static rendering are not available.

Press enter or click to view image in full size

Feature comparison of Expo Router vs Expo Webpack adapter

What is Metro Bundler?

The Metro bundler is maintained by the React org at Meta and used for bundling the majority of React Native apps.

The choice to use Metro for all platforms was driven by our mission to create a fully universal React framework — Expo Router.

We realized early on that delivering on this goal would require extensive bundler integration. Metro was a clear choice given all Expo apps use it for native platforms. Metro also has many important aspects that will make complex features like React Server Components especially efficient to bundle. Specifically, incremental bundling, aggressive caching, and a multi-dimensional graph which was originally designed for bundling multiple different platforms simultaneously.

Adding web and server support to Metro

Standard Metro doesn’t have web or server support so we had to build everything custom for Expo CLI. This was partially made easier by the fact that many features like Fast Refresh mostly worked universally.

Nowadays, we develop new bundler features almost entirely in the browser, and they just work™ on native. For example, TypeScript aliases, component stacks, environment variables, bundle splitting, etc. This has greatly improved our development speed and ultimately enabled us to release Expo Router v1, v2, and v3 in less than a year — a feat that would’ve been unimaginably difficult with multiple bundlers.

Get Evan Bacon’s stories in your inbox

Join Medium for free to get updates from this writer.

Remember me for faster sign in

Since we first introduced Metro for web in Expo SDK 46 (Aug 2022), we’ve added built-in support for file-based routing, CSS, Sass, PostCSS, Tailwind, bundle splitting, environment variables, fast refresh, static rendering, API routes, and many more powerful features which previously required lots of additional configuration on top of @expo/webpack-config.

Third party integrations

We’ve moved all of the now deprecated Webpack integrations to a smaller repo that’s easier for the community to contribute to: expo/expo-webpack-integrations.

Storybook

Storybook supports both Webpack and Metro bundler. We have an example template of using Storybook with Webpack to render components from the Expo SDK. You can bootstrap this using create-expo:

npx create-expo -e with-storybook

Next.js

Next.js support works by modifying the Next.js CLI to support bundling the Expo SDK. Last year, we updated the adapter to be more transparent and easier to control. Because the Expo CLI isn’t used in this workflow, it shouldn’t be affected by the deprecation. However, more complex features of the SDK that require bundler integration, such as Expo Router and Expo Constants, will continue to not work without additional support added to Next.js dev tooling. The adapter has moved to webpack-integrations.

Electron

The Electron adapter augmented electron-webpack to support rendering the Expo SDK (standard React / TypeScript libraries). The adapter has moved to webpack-integrations.

We will ultimately be recommending native-first solutions to desktop development in the future, but our focus is entirely on mobile development for now.

Custom features

For users with more custom features, e.g. a webpack.config.js file in the project, you can refer to the new bundling section in the Expo docs which outlines how to implement various popular features and patterns using universal Metro.

Please join our live stream on January 31st at 10:30 am PT to learn more about what’s new in Expo Router and the rest of SDK 50.