Skip to content

Commit 3183360

Browse files
committedJan 27, 2025
feat(feo): enable crd path configuration option
1 parent f8f477b commit 3183360

File tree

3 files changed

+58
-51
lines changed

3 files changed

+58
-51
lines changed
 

‎packages/config-utils/src/proxy.ts

-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ const proxy = ({
132132
bounceProd = false,
133133
useAgent = true,
134134
localApps = process.env.LOCAL_APPS,
135-
// should be just a mock, if not passed, the interceptor will not start
136-
// will be used once the interceptor is ready
137135
frontendCRDPath = path.resolve(process.cwd(), 'deploy/frontend.yaml'),
138136
}: ProxyOptions) => {
139137
const frontendCrd = readFrontendCRD(frontendCRDPath);

‎packages/config/src/bin/prod.webpack.config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const { config: webpackConfig, plugins } = config({
2424
...externalConfig,
2525
/** Do not use HMR for production builds */
2626
hotReload: false,
27+
/** Do configure/inti webpack dev server */
28+
deploymentBuild: true,
2729
});
2830

2931
const frontendCrd = readFrontendCRD(frontendCRDPath);

‎packages/config/src/lib/createConfig.ts

+56-49
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export interface CreateConfigOptions extends CommonConfigOptions {
5555
blockLegacyChrome?: boolean;
5656
devtool?: Configuration['devtool'];
5757
_unstableSpdy?: boolean;
58+
frontendCRDPath?: string;
59+
deploymentBuild?: boolean;
5860
}
5961

6062
export const createConfig = ({
@@ -101,6 +103,8 @@ export const createConfig = ({
101103
devtool = false,
102104
// enables SPDY as a dev server
103105
_unstableSpdy = false,
106+
frontendCRDPath = path.resolve(rootFolder, 'deploy/frontend.yaml'),
107+
deploymentBuild = false,
104108
}: CreateConfigOptions): Configuration => {
105109
if (typeof _unstableHotReload !== 'undefined') {
106110
fecLogger(LogType.warn, `The _unstableHotReload option in shared webpack config is deprecated. Use hotReload config instead.`);
@@ -269,56 +273,59 @@ export const createConfig = ({
269273
...resolve.fallback,
270274
},
271275
},
272-
devServer: {
273-
static: {
274-
directory: `${rootFolder || ''}/dist`,
275-
},
276-
port: devServerPort,
277-
server: _unstableSpdy ? 'spdy' : https || Boolean(useProxy) ? 'https' : 'http',
278-
host: '0.0.0.0', // This shares on local network. Needed for docker.host.internal
279-
hot: internalHotReload, // Use livereload instead of HMR which is spotty with federated modules
280-
liveReload: !internalHotReload,
281-
allowedHosts: 'all',
282-
// https://github.com/bripkens/connect-history-api-fallback
283-
historyApiFallback: {
284-
// We should really implement the same logic as cloud-services-config
285-
//
286-
// Until then let known api calls fall through instead of returning /index.html
287-
// for easier `fetch` debugging
288-
rewrites: [
289-
{ from: /^\/api/, to: '/404.html' },
290-
{ from: /^\/config/, to: '/404.html' },
291-
],
292-
verbose: Boolean(proxyVerbose),
293-
disableDotRule: true,
294-
},
295-
devMiddleware: {
296-
writeToDisk: true,
297-
},
298-
client,
299-
...proxy({
300-
env,
301-
localChrome,
302-
keycloakUri,
303-
customProxy,
304-
routes,
305-
routesPath,
306-
useProxy,
307-
proxyURL,
308-
standalone,
276+
...(!deploymentBuild && {
277+
devServer: {
278+
static: {
279+
directory: `${rootFolder || ''}/dist`,
280+
},
309281
port: devServerPort,
310-
reposDir,
311-
appUrl,
312-
publicPath,
313-
proxyVerbose,
314-
target,
315-
registry,
316-
bounceProd,
317-
useAgent,
318-
useDevBuild,
319-
blockLegacyChrome,
320-
}),
321-
},
282+
server: _unstableSpdy ? 'spdy' : https || Boolean(useProxy) ? 'https' : 'http',
283+
host: '0.0.0.0', // This shares on local network. Needed for docker.host.internal
284+
hot: internalHotReload, // Use livereload instead of HMR which is spotty with federated modules
285+
liveReload: !internalHotReload,
286+
allowedHosts: 'all',
287+
// https://github.com/bripkens/connect-history-api-fallback
288+
historyApiFallback: {
289+
// We should really implement the same logic as cloud-services-config
290+
//
291+
// Until then let known api calls fall through instead of returning /index.html
292+
// for easier `fetch` debugging
293+
rewrites: [
294+
{ from: /^\/api/, to: '/404.html' },
295+
{ from: /^\/config/, to: '/404.html' },
296+
],
297+
verbose: Boolean(proxyVerbose),
298+
disableDotRule: true,
299+
},
300+
devMiddleware: {
301+
writeToDisk: true,
302+
},
303+
client,
304+
...proxy({
305+
env,
306+
localChrome,
307+
keycloakUri,
308+
customProxy,
309+
routes,
310+
routesPath,
311+
useProxy,
312+
proxyURL,
313+
standalone,
314+
port: devServerPort,
315+
reposDir,
316+
appUrl,
317+
publicPath,
318+
proxyVerbose,
319+
target,
320+
registry,
321+
bounceProd,
322+
useAgent,
323+
useDevBuild,
324+
blockLegacyChrome,
325+
frontendCRDPath,
326+
}),
327+
},
328+
}),
322329
};
323330
};
324331

0 commit comments

Comments
 (0)
Please sign in to comment.