-
Hello! Upon adding it to the vite config, I immediately ran into #297, so I manually patched it to include #1182 (which seems safe to backport, btw). Is there a way to switch to ESM? I need to support both Chrome and Safari, so given that Safari defaults to MV2, are there any major caveats to switching? There also isn't content script support for ESM, so does switching in wxt even change the options rollup will get passed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
I have no idea what you're asking about... So I'll try and cover everything lol
While it is technically possible to code-split content scripts, you shouldn't need to do it. JS files are loaded from your disk, so chunk/bundle size is less important for chrome extensions. As for svelte, I know HTML pages work just fine with the default config, though I haven't personally tested content scripts since the release of svelte 5. You didn't mention where you are trying to use svelte at, HTML pages or content scripts. If content scripts don't work when using Did any of that address your problem? |
Beta Was this translation helpful? Give feedback.
Seems like it's trying to take more control of the build process, which WXT doesn't like.
You could configure it to build the sveltekit app in a separate build process, letting it build itself essentially, then grab the results and add whatever you need to the manifest.
Here's an example of doing an external build, in this case using vite to code-split a content script.
https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui
Specifically, here's where the external build step happens:
https://github.com/wxt-dev/examples/blob/f068a7c7b02048c91e6608804ad62091dfb2bbee/examples/esm-content-script-ui/modules/esm-builder.ts#L12