This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensions should be able to load static resources #277
Comments
I spent an obscene amount of time toying with this and the solution described above does kind of work. See here: foxglove/studio@main...rgov:rzg/extension-path In my extension's Webpack declare var __webpack_public_path__: string;
__webpack_public_path__ = (window as any).foobar; (Why |
A simpler way to do it, once the extension directory is plumbed through, is to set const unwrappedExtensionSource = (await extensionLoader.loadExtension(extension.id))
.replace("@FOXGLOVE_EXTENSION_PATH@", `file://${extension.directory}/dist/`); Except that this doesn't quite play well with the Content-Security-Policy; it seems to work fine when the app is built standalone but when running it in development mode, it doesn't want to load local resources. Perhaps you could implement a URL scheme like |
From live discussion: Problem statement
I created tickets to attempt examples for each of these |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
As far as I can tell, there is no recommended way to bundle a static resource with an extension and reference it at runtime.
I can configure Webpack thusly to enable Asset Modules for things like images.
The use of
asset/inline
here loads the whole image as a Base64-encodeddata:
URL that gets embedded into the DOM when I write,But I don't think it's possible to use
asset/resource
which instead inserts the path of the file, like<img src="./images/foobar.png">
, because the base URI to the extension is not exposed at runtime.Is it maybe possible to have the extension loader prepend something like
let __webpack_public_path__ = "...";
to the extension source code before executing it?The text was updated successfully, but these errors were encountered: