@@ -7,6 +7,9 @@ import { dirname, resolve } from 'node:path';
77const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
88const rootDir = resolve ( __dirname , '..' ) ;
99const toolbarSrc = resolve ( rootDir , 'toolbar' , 'src' , 'index.ts' ) ;
10+ const toolbarPluginsSrc = resolve ( rootDir , 'toolbar' , 'src' , 'plugins.ts' ) ;
11+ const toolbarReactSrc = resolve ( rootDir , 'toolbar' , 'src' , 'react.ts' ) ;
12+ const toolbarTypesSrc = resolve ( rootDir , 'toolbar' , 'src' , 'types-entry.ts' ) ;
1013
1114// https://vitejs.dev/config/
1215export default defineConfig ( ( { command } ) => {
@@ -17,6 +20,20 @@ export default defineConfig(({ command }) => {
1720 resolve : {
1821 alias : isDev
1922 ? [
23+ // More specific paths must come before the base path
24+ {
25+ find : '@launchdarkly/toolbar/plugins' ,
26+ replacement : toolbarPluginsSrc ,
27+ } ,
28+ {
29+ find : '@launchdarkly/toolbar/react' ,
30+ replacement : toolbarReactSrc ,
31+ } ,
32+ {
33+ find : '@launchdarkly/toolbar/types' ,
34+ replacement : toolbarTypesSrc ,
35+ } ,
36+ // Base path last (catches @launchdarkly/toolbar without subpath)
2037 {
2138 find : '@launchdarkly/toolbar' ,
2239 replacement : toolbarSrc ,
@@ -33,7 +50,12 @@ export default defineConfig(({ command }) => {
3350 : undefined ,
3451 optimizeDeps : isDev
3552 ? {
36- exclude : [ '@launchdarkly/toolbar' ] ,
53+ exclude : [
54+ '@launchdarkly/toolbar' ,
55+ '@launchdarkly/toolbar/plugins' ,
56+ '@launchdarkly/toolbar/react' ,
57+ '@launchdarkly/toolbar/types' ,
58+ ] ,
3759 }
3860 : undefined ,
3961 } ;
0 commit comments