mirror of https://github.com/status-im/metro.git
Remove compactMapping call from JS transformer
Reviewed By: mjesun Differential Revision: D6136200 fbshipit-source-id: a38cf19c247f60c0bfee01c39fae070043a76332
This commit is contained in:
parent
fa4091c63e
commit
d74685fd1d
|
@ -19,6 +19,8 @@ const inline = require('./inline');
|
|||
const invariant = require('fbjs/lib/invariant');
|
||||
const minify = require('./minify');
|
||||
|
||||
const {compactMapping} = require('../../Bundler/source-map');
|
||||
|
||||
import type {LogEntry} from '../../Logger/Types';
|
||||
import type {MappingsMap} from '../../lib/SourceMap';
|
||||
import type {LocalPath} from '../../node-haste/lib/toLocalPath';
|
||||
|
@ -123,6 +125,11 @@ const transformCode: TransformCode = asyncify(
|
|||
src: sourceCode,
|
||||
});
|
||||
|
||||
// TODO: Add more robust check once the transformer only returns rawMappings
|
||||
if (Array.isArray(transformed.map)) {
|
||||
transformed.map = transformed.map.map(compactMapping);
|
||||
}
|
||||
|
||||
invariant(
|
||||
transformed != null,
|
||||
'Missing transform results despite having no error.',
|
||||
|
|
|
@ -24,8 +24,6 @@ const makeHMRConfig = require('babel-preset-react-native/configs/hmr');
|
|||
const path = require('path');
|
||||
const resolvePlugins = require('babel-preset-react-native/lib/resolvePlugins');
|
||||
|
||||
const {compactMapping} = require('./Bundler/source-map');
|
||||
|
||||
import type {Plugins as BabelPlugins} from 'babel-core';
|
||||
import type {Transformer, TransformOptions} from './JSTransformer/worker';
|
||||
|
||||
|
@ -161,9 +159,7 @@ function transform({filename, options, src, plugins}: Params) {
|
|||
ast,
|
||||
code: result.code,
|
||||
filename,
|
||||
map: options.generateSourceMaps
|
||||
? result.map
|
||||
: result.rawMappings.map(compactMapping),
|
||||
map: options.generateSourceMaps ? result.map : result.rawMappings,
|
||||
};
|
||||
}
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue