Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix web assets not loading in Metro for web on Windows #19935

Merged
merged 3 commits into from Nov 8, 2022

Conversation

EvanBacon
Copy link
Contributor

Why

How

  • Normalize slashes on Windows to ensure they match the replacement key.

Test Plan

  • Added tests.
  • Need @byCedric to validate that the following renders an image on web when using Windows:
// Set `expo.web.bundler: 'metro'`

import { Image } from 'react-native';

// Requires an image file: ./icon.png
const icon = require('./icon.png');

export default function App() {
  return (
      <Image source={icon} style={{ width: 100, height: 100 }} />
  );
}

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Nov 8, 2022
@byCedric
Copy link
Member

byCedric commented Nov 8, 2022

Can confirm that this fixed web on Windows.

  • Created a new expo-router project
  • Added assets from default template
  • Loaded icon as described in snippet
  • Ran npx expo start --web (which didn't work)
  • Ran expod start --web (where `expod is an alias to the source) - and that did work.

Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Nov 8, 2022
@EvanBacon EvanBacon merged commit bc77495 into main Nov 8, 2022
@EvanBacon EvanBacon deleted the @evanbacon/cli/fix-metro-web-assets branch November 8, 2022 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows has Issues Bundling Assets on Web
3 participants