diff --git a/packages/metro-bundler/src/commands/serve.js b/packages/metro-bundler/src/commands/serve.js index f7359a53..b9627272 100644 --- a/packages/metro-bundler/src/commands/serve.js +++ b/packages/metro-bundler/src/commands/serve.js @@ -66,7 +66,7 @@ exports.handler = makeAsyncCommand(async (argv: any) => { } if (server) { - console.log('Configuration changed... restarting the server...'); + console.log('Configuration changed. Restarting the server...'); await promisify(server.close).call(server); } diff --git a/packages/metro-bundler/src/index.js b/packages/metro-bundler/src/index.js index bf8cdea1..fefdf0e6 100644 --- a/packages/metro-bundler/src/index.js +++ b/packages/metro-bundler/src/index.js @@ -79,10 +79,12 @@ async function runMetro({ }: PrivateMetroOptions) { const normalizedConfig = config ? normalizeConfig(config) : DEFAULT_CONFIG; - const assetExts = - (normalizedConfig.getAssetExts && normalizedConfig.getAssetExts()) || []; - const sourceExts = - (normalizedConfig.getSourceExts && normalizedConfig.getSourceExts()) || []; + const assetExts = defaultAssetExts.concat( + (normalizedConfig.getAssetExts && normalizedConfig.getAssetExts()) || [], + ); + const sourceExts = defaultSourceExts.concat( + (normalizedConfig.getSourceExts && normalizedConfig.getSourceExts()) || [], + ); const platforms = (normalizedConfig.getPlatforms && normalizedConfig.getPlatforms()) || []; @@ -96,7 +98,7 @@ async function runMetro({ : defaultProvidesModuleNodeModules; const serverOptions: ServerOptions = { - assetExts: defaultAssetExts.concat(assetExts), + assetExts: normalizedConfig.assetTransforms ? [] : assetExts, assetRegistryPath: normalizedConfig.assetRegistryPath, blacklistRE: normalizedConfig.getBlacklistRE(), extraNodeModules: normalizedConfig.extraNodeModules, @@ -114,7 +116,9 @@ async function runMetro({ providesModuleNodeModules, resetCache: false, reporter: new TerminalReporter(new Terminal(process.stdout)), - sourceExts: defaultSourceExts.concat(sourceExts), + sourceExts: normalizedConfig.assetTransforms + ? sourceExts.concat(assetExts) + : sourceExts, transformCache: TransformCaching.useTempDir(), transformModulePath, watch,