File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
import type { Plugin } from 'esbuild' ;
2
2
import path from 'path' ;
3
3
import { ConfigLoadingOptions , loadValidatedConfig } from '@app-config/config' ;
4
- import { generateModuleText , packageNameRegex } from '@app-config/utils' ;
4
+ import { appConfigImportRegex , generateModuleText , packageNameRegex } from '@app-config/utils' ;
5
5
import type { SchemaLoadingOptions } from '@app-config/schema' ;
6
6
7
7
export interface Options {
@@ -24,6 +24,11 @@ export const createPlugin = ({
24
24
namespace : '@app-config/esbuild' ,
25
25
} ) ) ;
26
26
27
+ build . onResolve ( { filter : appConfigImportRegex } , ( args ) => ( {
28
+ path : args . path ,
29
+ namespace : '@app-config/esbuild' ,
30
+ } ) ) ;
31
+
27
32
build . onLoad ( { filter : / .* / , namespace : '@app-config/esbuild' } , async ( ) => {
28
33
const { fullConfig, environment, validationFunctionCode, filePaths } =
29
34
await loadValidatedConfig ( loadingOptions , schemaLoadingOptions ) ;
Original file line number Diff line number Diff line change 1
1
import type { Plugin } from 'rollup' ;
2
- import { generateModuleText , packageNameRegex } from '@app-config/utils' ;
2
+ import { appConfigImportRegex , generateModuleText , packageNameRegex } from '@app-config/utils' ;
3
3
import { ConfigLoadingOptions , loadValidatedConfig } from '@app-config/config' ;
4
4
import type { SchemaLoadingOptions } from '@app-config/schema' ;
5
5
@@ -13,10 +13,6 @@ export interface Options {
13
13
readGlobal ?: boolean ;
14
14
}
15
15
16
- // vite resolves first before passing to the rollup plugin
17
- export const appConfigImportRegex =
18
- / ( a p p - c o n f i g | a p p - c o n f i g - m a i n | @ a p p - c o n f i g \/ m a i n ) \/ d i s t ( \/ e s ) ? \/ i n d e x \. j s / ;
19
-
20
16
export default function appConfigRollup (
21
17
options : Options = { } ,
22
18
) : Plugin & { currentFilePaths ?: string [ ] } {
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ export const isWindows = isNode && /^win/.test(process.platform);
7
7
export const packageNameRegex =
8
8
/ ( ^ @ ( l c d e v | s e r v a l l ) \/ a p p - c o n f i g ) | ( ^ @ a p p - c o n f i g \/ m a i n ) | ( \. ? a p p - c o n f i g ( \. \w + ) ? \. ( t o m l | y m l | y a m l | j s o n | j s o n 5 ) ) | ( \. c o n f i g - p l a c e h o l d e r ) / ;
9
9
10
+ export const appConfigImportRegex =
11
+ / ( a p p - c o n f i g | a p p - c o n f i g - m a i n | @ a p p - c o n f i g \/ m a i n ) \/ d i s t ( \/ e s ) ? \/ i n d e x \. j s / ;
12
+
10
13
export type JsonPrimitive = number | string | boolean | null ;
11
14
12
15
export interface JsonObject {
You can’t perform that action at this time.
0 commit comments