File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
packages/brick-container/serve Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const cli = meow(
2424 --live-reload Enable live reload (currently only for local micro-apps)
2525 --size-check Enable size-check mode
2626 --cookie-same-site-none Append "Same-Site: none" for cookies
27+ --no-force-standalone Disable force standalone mode
2728 --verbose Print verbose logs
2829 --help Show help message
2930 --version Show brick container version
@@ -72,6 +73,10 @@ const cli = meow(
7273 sizeCheck : {
7374 type : "boolean" ,
7475 } ,
76+ forceStandalone : {
77+ type : "boolean" ,
78+ default : true ,
79+ } ,
7580 verbose : {
7681 type : "boolean" ,
7782 } ,
@@ -158,6 +163,7 @@ export async function getEnv(rootDir, runtimeFlags) {
158163 server : getServerPath ( flags . server ) ,
159164 sizeCheck : flags . sizeCheck ,
160165 sizeCheckFilter,
166+ forceStandalone : flags . forceStandalone ,
161167 verbose : flags . verbose ,
162168 } ;
163169
Original file line number Diff line number Diff line change @@ -4,11 +4,16 @@ import { responseInterceptor } from "http-proxy-middleware";
44import _ from "lodash" ;
55import jsYaml from "js-yaml" ;
66import { getBrickPackages } from "@next-core/serve-helpers" ;
7- import { getStoryboards , getSingleStoryboard } from "./utils/getStoryboards.js" ;
7+ import {
8+ getStoryboards ,
9+ getSingleStoryboard ,
10+ getMatchedStoryboard ,
11+ } from "./utils/getStoryboards.js" ;
812import { fixV2Storyboard } from "./utils/fixV2Storyboard.js" ;
913import { injectIndexHtml } from "./utils/injectIndexHtml.js" ;
1014import { getProcessedPublicDeps } from "./utils/getProcessedPublicDeps.js" ;
1115import { concatBrickPackages } from "./utils/concatBrickPackages.js" ;
16+ import { getStandaloneConfig } from "./utils/getStandaloneConfig.js" ;
1217// Create an http agent that always use IPv4
1318let agent ;
1419const getAgent = ( server ) => {
@@ -424,6 +429,14 @@ export default function getProxy(env, getRawIndexHtml) {
424429 unionAppRoot,
425430 bootstrapUnionFilePath,
426431 } ) ;
432+ } else if ( env . forceStandalone ) {
433+ const storyboard = await getMatchedStoryboard (
434+ env ,
435+ req . path . replace ( / ^ \/ n e x t \/ / , "/" )
436+ ) ;
437+ const content = await getRawIndexHtml ( ) ;
438+ const standaloneConfig = getStandaloneConfig ( storyboard ) ;
439+ return injectIndexHtml ( env , content , standaloneConfig ) ;
427440 }
428441 return injectIndexHtml ( env , rawIndexHtml ) ;
429442 } else {
You can’t perform that action at this time.
0 commit comments