mirror of https://github.com/status-im/metro.git
When the sourceMap option is false, try to listen to it better
Summary: I think the default value for the `--source-map` option is true, although it's not defined that way explicitly. Regardless, when it's explicitly set to `false` I would expect Metro to at least listen to that. Currently that's not the case. This diff attempts to improve that situation. Note that it's still not perfect since there are more places where sourcemaps are still being touched when this flag is `false`. It turns out adding a proper flag for this leads to a lot of cascading type problems and so I ended up with this fix instead. Reviewed By: rafeca Differential Revision: D6884423 fbshipit-source-id: 7fe10045d9d9f73c7841588627ba41b14c2e412b
This commit is contained in:
parent
eb08ed4adc
commit
d6e80c4ebf
|
@ -289,7 +289,8 @@ exports.runBuild = async (options: RunBuildOptions) => {
|
||||||
inlineSourceMap: options.sourceMap && !!options.sourceMapUrl,
|
inlineSourceMap: options.sourceMap && !!options.sourceMapUrl,
|
||||||
minify: options.optimize || false,
|
minify: options.optimize || false,
|
||||||
platform: options.platform || `web`,
|
platform: options.platform || `web`,
|
||||||
sourceMapUrl: options.sourceMapUrl,
|
sourceMapUrl:
|
||||||
|
options.sourceMap === false ? undefined : options.sourceMapUrl,
|
||||||
createModuleIdFactory: options.config
|
createModuleIdFactory: options.config
|
||||||
? options.config.createModuleIdFactory
|
? options.config.createModuleIdFactory
|
||||||
: undefined,
|
: undefined,
|
||||||
|
@ -299,7 +300,10 @@ exports.runBuild = async (options: RunBuildOptions) => {
|
||||||
|
|
||||||
const outputOptions: OutputOptions = {
|
const outputOptions: OutputOptions = {
|
||||||
bundleOutput: options.out.replace(/(\.js)?$/, '.js'),
|
bundleOutput: options.out.replace(/(\.js)?$/, '.js'),
|
||||||
sourcemapOutput: options.out.replace(/(\.js)?$/, '.map'),
|
sourcemapOutput:
|
||||||
|
options.sourceMap === false
|
||||||
|
? undefined
|
||||||
|
: options.out.replace(/(\.js)?$/, '.map'),
|
||||||
dev: options.dev,
|
dev: options.dev,
|
||||||
platform: options.platform || `web`,
|
platform: options.platform || `web`,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue