1*26ad19fcSEvan Bacondeclare const process: any; 2*26ad19fcSEvan Bacon 3*26ad19fcSEvan Baconfunction openFileInEditor(file: string, lineNumber: number) { 4*26ad19fcSEvan Bacon if (process.env.NODE_ENV !== 'production') { 5*26ad19fcSEvan Bacon // TODO: This is not a great URL since it now blocks users from accessing the `/open-stack-frame` url in their router 6*26ad19fcSEvan Bacon // ideally it would be something like `/_devtools/open-stack-frame`. 7*26ad19fcSEvan Bacon const baseUrl = window.location.protocol + '//' + window.location.host; 8*26ad19fcSEvan Bacon 9*26ad19fcSEvan Bacon fetch(baseUrl + '/open-stack-frame', { 10*26ad19fcSEvan Bacon method: 'POST', 11*26ad19fcSEvan Bacon body: JSON.stringify({ file, lineNumber }), 12*26ad19fcSEvan Bacon }); 13*26ad19fcSEvan Bacon } 14*26ad19fcSEvan Bacon} 15*26ad19fcSEvan Bacon 16*26ad19fcSEvan Baconexport default openFileInEditor; 17