Remove inlined source maps from debug builds
Summary: Disabled producing inline source maps for debug builds. Source maps are already writte to "map" files, so this does not make sense to also inline them to the js bundle. Passing "sourceMapUrl" parameter to Metro fixed this. Reviewed By: mweststrate Differential Revision: D22159501 fbshipit-source-id: f06225cd43f44a7f93afcc32bb0501323b35d0c3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f373872b5c
commit
b69996ca50
@@ -69,7 +69,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/react": "^10.0.2",
|
"@testing-library/react": "^10.0.2",
|
||||||
"flipper-test-utils": "0.47.0",
|
"flipper-test-utils": "0.47.0",
|
||||||
"mac-ca": "^1.0.4",
|
|
||||||
"metro": "^0.59.0",
|
"metro": "^0.59.0",
|
||||||
"mock-fs": "^4.12.0",
|
"mock-fs": "^4.12.0",
|
||||||
"pretty-format": "^25.4.0",
|
"pretty-format": "^25.4.0",
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ export default async function runBuild(
|
|||||||
out: string,
|
out: string,
|
||||||
dev: boolean,
|
dev: boolean,
|
||||||
) {
|
) {
|
||||||
|
const sourceMapUrl = path.basename(
|
||||||
|
out.substring(0, out.lastIndexOf('.')) + '.map',
|
||||||
|
);
|
||||||
const baseConfig = await Metro.loadConfig();
|
const baseConfig = await Metro.loadConfig();
|
||||||
const config = Object.assign({}, baseConfig, {
|
const config = Object.assign({}, baseConfig, {
|
||||||
reporter: {update: () => {}},
|
reporter: {update: () => {}},
|
||||||
@@ -70,6 +73,7 @@ export default async function runBuild(
|
|||||||
minify: !dev,
|
minify: !dev,
|
||||||
resetCache: !dev,
|
resetCache: !dev,
|
||||||
sourceMap: dev,
|
sourceMap: dev,
|
||||||
|
sourceMapUrl,
|
||||||
entry,
|
entry,
|
||||||
out,
|
out,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ async function compile(
|
|||||||
watchFolders: string[],
|
watchFolders: string[],
|
||||||
entry: string,
|
entry: string,
|
||||||
) {
|
) {
|
||||||
|
const out = path.join(buildFolder, 'bundle.js');
|
||||||
|
const sourceMapUrl = dev ? 'bundle.map' : undefined;
|
||||||
await Metro.runBuild(
|
await Metro.runBuild(
|
||||||
{
|
{
|
||||||
reporter: {update: () => {}},
|
reporter: {update: () => {}},
|
||||||
@@ -98,8 +100,9 @@ async function compile(
|
|||||||
minify: !dev,
|
minify: !dev,
|
||||||
resetCache: !dev,
|
resetCache: !dev,
|
||||||
sourceMap: dev,
|
sourceMap: dev,
|
||||||
|
sourceMapUrl,
|
||||||
entry,
|
entry,
|
||||||
out: path.join(buildFolder, 'bundle.js'),
|
out,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"flipper-plugin-lib": "0.47.0",
|
"flipper-plugin-lib": "0.47.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"ignore": "^5.1.4",
|
"ignore": "^5.1.4",
|
||||||
|
"mac-ca": "^1.0.4",
|
||||||
"mem": "^6.0.0",
|
"mem": "^6.0.0",
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"p-filter": "^2.1.0",
|
"p-filter": "^2.1.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user