Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/guide/essentials/remote-code.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Remote Code

:::warning Deprecated
This feature is susceptible to supply-chain attacks and will be removed in the next major version of WXT. See [issue #2262](https://github.com/wxt-dev/wxt/issues/2262) for more details.
:::

WXT will automatically download and bundle imports with the `url:` prefix so the extension does not depend on remote code, [a requirement from Google for MV3](https://developer.chrome.com/docs/extensions/migrating/improve-security/#remove-remote-code).

## Google Analytics
Expand Down
7 changes: 7 additions & 0 deletions packages/wxt/src/core/builders/vite/plugins/download.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import type { Plugin } from 'vite';
import type { ResolvedConfig } from '../../../../types';
import { fetchCached } from '../../../utils/network';
import consola from 'consola';

/**
* Downloads any URL imports, like Google Analytics, into virtual modules so
* they are bundled with the extension instead of depending on remote code at
* runtime.
*
* @deprecated This feature is susceptible to supply-chain attacks and will be
* removed in the next major version of WXT. See
* https://github.com/wxt-dev/wxt/issues/2262 for more details.'
* @example
* import 'url:https://google-tagmanager.com/gtag?id=XYZ';
*/
Expand All @@ -29,6 +33,9 @@ export function download(config: ResolvedConfig): Plugin {
},
handler(id) {
const url = id.replace('\0url:', '');
consola.warn(
Comment thread
nishu-murmu marked this conversation as resolved.
Outdated
`Deprecated: This feature is susceptible to supply-chain attacks and will be removed in the next major version of WXT. See https://github.com/wxt-dev/wxt/issues/2262 for more details.`,
);
return fetchCached(url, config);
},
},
Expand Down
Loading