diff --git a/packages/metro-bundler/src/Server/index.js b/packages/metro-bundler/src/Server/index.js index ba942ae2..02b3fe03 100644 --- a/packages/metro-bundler/src/Server/index.js +++ b/packages/metro-bundler/src/Server/index.js @@ -91,7 +91,7 @@ export type Options = {| silent?: boolean, +sourceExts: ?Array, +transformCache: TransformCache, - +transformModulePath: string, + transformModulePath?: string, watch?: boolean, workerPath: ?string, |}; @@ -214,7 +214,8 @@ class Server { silent: options.silent || false, sourceExts: options.sourceExts || defaults.sourceExts, transformCache: options.transformCache, - transformModulePath: options.transformModulePath, + transformModulePath: + options.transformModulePath || defaults.transformModulePath, watch: options.watch || false, workerPath: options.workerPath, }; diff --git a/packages/metro-bundler/src/defaultTransform.js b/packages/metro-bundler/src/defaultTransform.js new file mode 100644 index 00000000..5ed2090f --- /dev/null +++ b/packages/metro-bundler/src/defaultTransform.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + */ +'use strict'; + +module.exports.transform = (file: {src: string}) => ({code: file.src}); diff --git a/packages/metro-bundler/src/defaults.js b/packages/metro-bundler/src/defaults.js index 6b862d1e..eeb15f21 100644 --- a/packages/metro-bundler/src/defaults.js +++ b/packages/metro-bundler/src/defaults.js @@ -29,6 +29,8 @@ exports.providesModuleNodeModules = [ 'react-native-windows', ]; +exports.transformModulePath = require.resolve('./defaultTransform.js'); + exports.runBeforeMainModule = [ // Ensures essential globals are available and are patched correctly. 'InitializeCore',