From d41bc86fd9fec9c55ae72bd4cdc1508097f7796b Mon Sep 17 00:00:00 2001 From: James Ide Date: Mon, 29 Oct 2018 23:46:12 -0700 Subject: [PATCH] [expo][assets] Register the Expo asset plugin with Metro 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. --- local-cli/core/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/local-cli/core/index.js b/local-cli/core/index.js index 752afaee22b5e5..86221c5c51d0a9 100644 --- a/local-cli/core/index.js +++ b/local-cli/core/index.js @@ -132,6 +132,15 @@ async function getCliConfig(): Promise { ); 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