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,
|
||||
async requirePlugin(path) {
|
||||
let source = await flipperServer.exec('plugin-source', path);
|
||||
|
||||
// append source url (to make sure a file entry shows up in the debugger)
|
||||
source += `\n//# sourceURL=file://${path}`;
|
||||
// and source map url (to get source code if available)
|
||||
source += `\n//# sourceMappingURL=file://${path.replace(/.js$/, '.map')}`;
|
||||
if (isProduction()) {
|
||||
// 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
|
||||
// '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
|
||||
'fsevents',
|
||||
],
|
||||
sourcemap: 'external',
|
||||
sourcemap: dev ? 'inline' : 'external',
|
||||
minify: !dev,
|
||||
plugins: intern ? [resolveFbStubsToFbPlugin] : undefined,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user