cli,frontend-app-api: more cleanup

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-05 18:07:27 +02:00
parent 888748f10b
commit 3f49724db8
6 changed files with 14 additions and 8 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ import { createConfig, resolveBaseUrl } from './config';
import { BuildOptions } from './types';
import { resolveBundlingPaths } from './paths';
import chalk from 'chalk';
import { createDetectedModulesEntrypoint } from './packageDetection';
import { createDetectedModulesEntryPoint } from './packageDetection';
// TODO(Rugvip): Limits from CRA, we might want to tweak these though.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
@@ -42,7 +42,7 @@ export async function buildBundle(options: BuildOptions) {
const paths = resolveBundlingPaths(options);
const detectedModulesEntryPoint = await createDetectedModulesEntrypoint({
const detectedModulesEntryPoint = await createDetectedModulesEntryPoint({
config: options.fullConfig,
targetPath: paths.targetPath,
});
@@ -32,7 +32,7 @@ function readPackageDetectionConfig(
config: Config,
): PackageDetectionConfig | undefined {
const packages = config.getOptional('app.experimental.packages');
if (!packages) {
if (packages === undefined || packages === null) {
return undefined;
}
@@ -100,7 +100,7 @@ async function writeDetectedPackagesModule(packageNames: string[]) {
);
}
export async function createDetectedModulesEntrypoint(options: {
export async function createDetectedModulesEntryPoint(options: {
config: Config;
targetPath: string;
watch?: () => void;
+3 -1
View File
@@ -31,12 +31,13 @@ import { paths as libPaths } from '../../lib/paths';
import { loadCliConfig } from '../config';
import { Lockfile } from '../versioning';
import { createConfig, resolveBaseUrl } from './config';
import { createDetectedModulesEntrypoint as createDetectedModulesEntryPoint } from './packageDetection';
import { createDetectedModulesEntryPoint } from './packageDetection';
import { resolveBundlingPaths } from './paths';
import { ServeOptions } from './types';
export async function serveBundle(options: ServeOptions) {
const paths = resolveBundlingPaths(options);
const targetPkg = await fs.readJson(paths.targetPackageJson);
if (options.verifyVersions) {
const lockfile = await Lockfile.load(
@@ -170,6 +171,7 @@ export async function serveBundle(options: ServeOptions) {
: false,
host,
port,
proxy: targetPkg.proxy,
// When the dev server is behind a proxy, the host and public hostname differ
allowedHosts: [url.hostname],
client: {