File tree Expand file tree Collapse file tree
packages/astro/src/vite-plugin-config-alias Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
12import path from 'node:path' ;
23import type { CompilerOptions } from 'typescript' ;
3- import { normalizePath , type Plugin as VitePlugin } from 'vite' ;
4+ import { normalizePath , type ResolvedConfig , type Plugin as VitePlugin } from 'vite' ;
5+
46import type { AstroSettings } from '../types/astro.js' ;
5- import fs from 'node:fs' ;
67
78type Alias = {
89 find : RegExp ;
@@ -97,7 +98,9 @@ const getViteResolveAlias = (settings: AstroSettings) => {
9798 } ;
9899
99100 aliases . push ( {
100- find : new RegExp ( `^${ aliasPattern . replace ( / [ \\ ^ $ + ? . ( ) | [ \] { } ] / g, '\\$&' ) . replace ( / \* / g, '(.+)' ) } $` ) ,
101+ find : new RegExp (
102+ `^${ aliasPattern . replace ( / [ \\ ^ $ + ? . ( ) | [ \] { } ] / g, '\\$&' ) . replace ( / \* / g, '(.+)' ) } $` ,
103+ ) ,
101104 replacement : aliasPattern . includes ( '*' ) ? '$1' : aliasPattern ,
102105 customResolver,
103106 } ) ;
@@ -190,7 +193,7 @@ function patchCreateResolver(config: ResolvedConfig, postPlugin: VitePlugin) {
190193 ssr,
191194 } ;
192195
193- const result = await resolver . apply ( resolver , args2 ) ;
196+ const result = await resolver . apply ( _createResolver , args2 ) ;
194197 if ( result ) return result ;
195198
196199 // @ts -expect-error resolveId exists
You can’t perform that action at this time.
0 commit comments