Skip to content

Fix/vite path alias configuration 142#202

Merged
Mosas2000 merged 20 commits into
mainfrom
fix/vite-path-alias-configuration-142
May 21, 2026
Merged

Fix/vite path alias configuration 142#202
Mosas2000 merged 20 commits into
mainfrom
fix/vite-path-alias-configuration-142

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

What was fixed:

vite.config.ts — added resolve.alias mapping @ to ./src, removed redundant test block and inline comments
index.charting.ts — replaced broken re-export from non-existent useChartingHooks with the four actual hook files that exist
vitest.config.ts — aligned path import style with vite.config.ts for consistency
tsconfig.node.json — added vitest.config.ts to the include array so Node types resolve correctly for both config files
184 source files across middleware/, utils/, constants/, hooks/, services/, components/, pages/, examples/, contexts/, config/, and types/ — all cross-directory ../ relative imports converted to @/ alias imports

Closes #142

Mosas2000 added 20 commits May 21, 2026 19:12
Map the @ alias to the src directory so all @/ imports resolve
correctly at build time. Without this, Vite cannot resolve modules
like @/services/RateLimitService or @/types/rateLimit.

Closes #142
index.charting.ts was re-exporting from @/hooks/useChartingHooks which
never existed. The charting hooks were split across four separate files:
useChartState, useChartIndicators, useChartDrawing, and useChartRendering.

Update the re-exports to point to the files that actually exist.
Both configs now use path as a default import and call path.resolve()
for the @ alias, keeping the two config files consistent.
vitest.config.ts imports from the node path module and needs to be
covered by the node tsconfig so TypeScript resolves the Node types
correctly for both config files.
Replace ../services/RateLimitService with @/services/RateLimitService
to be consistent with the rest of the codebase and to rely on the
resolved path alias rather than a fragile relative path.
All nine re-exports were using ../ relative paths. Replace them with
@/ alias imports to match the project convention and ensure they
resolve correctly through the Vite alias configuration.
Replace ../services/RateLimitService with @/services/RateLimitService
to match the project-wide convention and resolve through the Vite
path alias rather than a relative path.
Replace ../types/market with @/types/market for both the type import
and the value import to be consistent with the rest of the codebase.
Replace ../utils/networkUtils with @/utils/networkUtils to match
the project convention for cross-directory imports.
Replace ../components/* and ../hooks/* relative paths with @/ alias
imports for ErrorBoundary, PageErrorBoundary, ErrorMessage, and
useErrorHandler.
templateStorage.ts and cacheHelpers.ts both imported GDPRComplianceService
and SecureStorageV2Service using ../services/ relative paths. Replace
with @/ alias imports to match the project convention.
Replace ../types/market and ../types/analytics relative imports with
@/ alias paths in marketValidation.ts and analytics.ts.
…ketAnalyzer

Replace ../types/market, ../types/accessibility, and ../types/websocket
relative imports with @/ alias paths in the three utility files.
Replace ../types/template and ../types/notifications relative imports
with @/ alias paths in templateValidation.ts, notificationTemplates.ts,
and templateSuggestions.ts.
Replace ../types/template in config/templates.ts and ../utils/marketCategories
in types/filters.ts with @/ alias imports.
Replace ../types/network and ../utils/networkUtils relative imports
with @/ alias paths in NetworkContext.tsx.
…listContext

Replace ../utils/recentlyViewed and ../utils/watchlist relative imports
with @/ alias paths in both context files.
Bulk convert all cross-directory relative imports in src/utils/ and
src/constants/ to use the @/ path alias. Covers contractErrorHandler,
networkUtils, transactions, gdprInitializer, storageAudit, stakeHistory,
referralTracking, explorerLinks, exportHelpers, exportValidator,
notificationHelpers, portfolioHelpers, reputationAnalytics,
reputationCalculations, reputationHelpers, reputationUtils,
stakingHelpers, templateAnalytics, templateHelper, websocketUtils,
and constants/index.
Bulk convert all cross-directory relative imports in src/hooks/ and
src/services/ to use the @/ path alias. Covers all 66 files including
useContract, useMarkets, useStake, useGovernance, useLiquidity,
useExport, useNotifications, useRateLimit, ApiClient, ExportService,
NotificationService, RealtimeMarketClient, and all other hooks and
services that were using ../ relative paths.
Bulk convert all cross-directory relative imports in src/components/,
src/pages/, and src/examples/ to use the @/ path alias. Covers all 97
files including MarketForm, MarketCard, Header, Footer, NetworkContext
consumers, all page components, and example files that were using ../
relative paths to reach services, types, hooks, utils, and contexts.
@Mosas2000 Mosas2000 merged commit e295fe5 into main May 21, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing path alias configuration for @ imports

1 participant