Files
wxt/docs/guide/directory-structure/public/index.md
T
2024-06-03 18:43:25 -05:00

731 B

public/

Place static files like the extension icon or _locales/ directory here. These files will be copied over to the output directory without being transformed by Vite.

<srcDir>
└─ public/
   ├─ icon-16.png
   ├─ icon-32.png
   ├─ icon-48.png
   ├─ icon-96.png
   └─ icon-128.png

Example

You can reference these files by using absolute paths in HTML files or browser.runtime.getURL in content scripts.

:::code-group

<img src="/icon-128.png" />
defineContentScript({
  main() {
    const image = document.createElement('img');
    image.src = browser.runtime.getURL('/icon-128.png');
    document.body.append(image);
  },
});

:::