Introduce static resource URLs

Summary: Introduced an API that converts a filepath, relatively to the `desktop/static/` folder in a url that can be resolved by the render environment. This will generate `file://` urls in Electron, and root relative `/` urls in browser envs

Reviewed By: aigoncharov

Differential Revision: D32767427

fbshipit-source-id: 378da7709bcb19449873358a8703b9c5a5809c57
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 129cbd6f7b
commit 86995e0d11
4 changed files with 14 additions and 0 deletions

View File

@@ -187,5 +187,8 @@ function createStubRenderHost(): RenderHost {
async requirePlugin(path: string) {
return require(path);
},
getStaticResourceUrl(relativePath): string {
return 'file://' + resolve(rootPath, 'static', relativePath);
},
};
}