File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
packages/analytics/modules/analytics Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import 'wxt' ;
22import 'wxt/sandbox' ;
3- import { addAlias , addWxtPlugin , defineWxtModule } from 'wxt/modules' ;
3+ import {
4+ addAlias ,
5+ addViteConfig ,
6+ addWxtPlugin ,
7+ defineWxtModule ,
8+ } from 'wxt/modules' ;
49import { relative , resolve } from 'node:path' ;
510import type { AnalyticsConfig } from './types' ;
611
@@ -72,5 +77,15 @@ export default defineWxtModule({
7277 // Ensure analytics is initialized in every context, mainly the background.
7378 // TODO: Once there's a way to filter which entrypoints a plugin is applied to, only apply this to the background
7479 addWxtPlugin ( wxt , pluginModuleId ) ;
80+
81+ // Fix issues with dependencies
82+ addViteConfig ( wxt , ( ) => ( {
83+ optimizeDeps : {
84+ // Ensure the "#analytics" import is processed by vite in the background plugin
85+ exclude : [ '@wxt-dev/analytics' ] ,
86+ // Ensure the CJS subdependency is preprocessed into ESM
87+ include : [ '@wxt-dev/analytics > ua-parser-js' ] ,
88+ } ,
89+ } ) ) ;
7590 } ,
7691} ) ;
You can’t perform that action at this time.
0 commit comments