Fix plugin source maps in dev mode
Summary: Start bundling source maps together with the source code itself in the dev mode. Therefore it is no longer required to add a link to the external source map file in dev mode. In prod mode we still ship them separately. Reviewed By: mweststrate Differential Revision: D39775064 fbshipit-source-id: 6c56df7a3fce084c07a8618a63dbd8ae4741348c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6f65517933
commit
982193df48
@@ -82,10 +82,13 @@ export function initializeRenderHost(
|
|||||||
flipperServer,
|
flipperServer,
|
||||||
async requirePlugin(path) {
|
async requirePlugin(path) {
|
||||||
let source = await flipperServer.exec('plugin-source', path);
|
let source = await flipperServer.exec('plugin-source', path);
|
||||||
|
|
||||||
// append source url (to make sure a file entry shows up in the debugger)
|
// append source url (to make sure a file entry shows up in the debugger)
|
||||||
source += `\n//# sourceURL=file://${path}`;
|
source += `\n//# sourceURL=file://${path}`;
|
||||||
// and source map url (to get source code if available)
|
if (isProduction()) {
|
||||||
source += `\n//# sourceMappingURL=file://${path.replace(/.js$/, '.map')}`;
|
// and source map url (to get source code if available)
|
||||||
|
source += `\n//# sourceMappingURL=file://${path}.map`;
|
||||||
|
}
|
||||||
|
|
||||||
// Plugins are compiled as typical CJS modules, referring to the global
|
// Plugins are compiled as typical CJS modules, referring to the global
|
||||||
// 'module', which we'll make available by loading the source into a closure that captures 'module'.
|
// 'module', which we'll make available by loading the source into a closure that captures 'module'.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ async function runBuild({
|
|||||||
// It is an optional dependency for rollup that we use in react-devtools
|
// It is an optional dependency for rollup that we use in react-devtools
|
||||||
'fsevents',
|
'fsevents',
|
||||||
],
|
],
|
||||||
sourcemap: 'external',
|
sourcemap: dev ? 'inline' : 'external',
|
||||||
minify: !dev,
|
minify: !dev,
|
||||||
plugins: intern ? [resolveFbStubsToFbPlugin] : undefined,
|
plugins: intern ? [resolveFbStubsToFbPlugin] : undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user