2016-02-03 16:14:38 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-03-01 11:20:54 +00:00
|
|
|
var path = require('path');
|
2016-02-03 16:14:38 +00:00
|
|
|
var resolvePlugins = require('../lib/resolvePlugins');
|
|
|
|
|
2016-03-01 11:20:54 +00:00
|
|
|
var hmrTransform = 'react-transform-hmr/lib/index.js';
|
|
|
|
var transformPath = require.resolve(hmrTransform);
|
|
|
|
|
|
|
|
module.exports = function(options, filename) {
|
|
|
|
var transform = filename
|
2016-03-21 22:44:12 +00:00
|
|
|
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
|
2016-03-01 11:20:54 +00:00
|
|
|
: hmrTransform;
|
2016-02-03 16:14:38 +00:00
|
|
|
return {
|
|
|
|
plugins: resolvePlugins([
|
|
|
|
[
|
|
|
|
'react-transform',
|
|
|
|
{
|
|
|
|
transforms: [{
|
2016-03-01 11:20:54 +00:00
|
|
|
transform: transform,
|
2016-04-01 15:07:20 +00:00
|
|
|
imports: ['react-native/Libraries/react-native/react-native.js'],
|
2016-02-03 16:14:38 +00:00
|
|
|
locals: ['module'],
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
])
|
|
|
|
};
|
2016-03-21 22:44:12 +00:00
|
|
|
};
|