Skip to content

Commit

Permalink
[expo][assets] Register the Expo asset plugin with Metro
Browse files Browse the repository at this point in the history
Expo comes with an asset plugin that adds the MD5 checksums of asset files to each asset object. This is used when uploading hosted assets.

We need to extend Metro and the RN CLI parameters to support passing in plugins from Expo CLI but for SDK 31 we'll patch RN directly.
  • Loading branch information
ide committed Oct 30, 2018
1 parent e33acdc commit d41bc86
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions local-cli/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ async function getCliConfig(): Promise<RNConfig> {
);

config.transformer.assetRegistryPath = ASSET_REGISTRY_PATH;

// NOTE(expo): include the Expo asset plugin to support static resources
try {
let expoAssetPluginPath = require.resolve('expo/tools/hashAssetFiles');
config.transformer.assetPlugins = [expoAssetPluginPath];
} catch (e) {
console.warn('Could not find the "expo" package in your project when configuring the packager');
}

config.resolver.hasteImplModulePath =
config.resolver.hasteImplModulePath || defaultConfig.hasteImplModulePath;
config.resolver.platforms = config.resolver.platforms
Expand Down

0 comments on commit d41bc86

Please sign in to comment.