Prepend passed sourceExts to default ones and pass them to metro (#21855)

Summary:
Fixes react-native start not using passed --sourceExts #21854
Pull Request resolved: https://github.com/facebook/react-native/pull/21855

Differential Revision: D12840358

Pulled By: rafeca

fbshipit-source-id: 4ee09341b5128d83274a39d8d01c13749efaa78b
This commit is contained in:
Ely Alvarado
2018-10-30 15:11:35 -07:00
committed by Facebook Github Bot
parent cae253427a
commit ce860803a4

View File

@@ -70,6 +70,13 @@ async function runServer(args: Args, config: ConfigT) {
config.server.enhanceMiddleware = middleware =>
middlewareManager.getConnectInstance().use(middleware);
if (args.sourceExts !== config.resolver.sourceExts) {
// $FlowFixMe Metro configuration is immutable.
config.resolver.sourceExts = args.sourceExts.concat(
config.resolver.sourceExts,
);
}
const serverInstance = await Metro.runServer(config, {
host: args.host,
secure: args.https,