File tree Expand file tree Collapse file tree
packages/cli/src/features/scaffold/templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ export const env = arkenv({
1414 DATABASE_URL: " string" ,
1515 NEXT_PUBLIC_API_URL: " string" ,
1616 NODE_ENV: " 'development' | 'production' | 'test' = 'development'" ,
17+ CUSTOM_VAR: " string" ,
18+ }, {
19+ exposeToClient: [" CUSTOM_VAR" ]
1720});
1821```
1922
Original file line number Diff line number Diff line change @@ -94,10 +94,12 @@ export function buildNextjsTemplate(
9494 const flatFields = allFields . map ( ( field ) => field . replace ( / ^ \t \t / , "\t" ) ) ;
9595
9696 const exposedKeyNames : string [ ] = [ ] ;
97- if ( envKeys && envKeys . length > 0 ) {
98- for ( const key of envKeys ) {
99- if ( key === "NODE_ENV" ) {
100- // NODE_ENV is implicitly shared, no need to list it in options.expose
97+ for ( const field of sharedFields ) {
98+ const match = field . trim ( ) . match ( / ^ ( [ a - z A - Z 0 - 9 _ ] + ) \s * : / ) ;
99+ if ( match ) {
100+ const key = match [ 1 ] ;
101+ if ( key !== "NODE_ENV" ) {
102+ exposedKeyNames . push ( key ) ;
101103 }
102104 }
103105 }
You can’t perform that action at this time.
0 commit comments