Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 93782e7

Browse files
jthoms1danbucholtz
authored andcommitted
fix(serve): add flag to indicate to serve for a cordova app
1 parent a0c3f5d commit 93782e7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/dev-server/http-server.ts

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ function servePlatformResource(req: express.Request, res: express.Response, next
9999
const userAgent = req.header('user-agent');
100100
let resourcePath = config.wwwDir;
101101

102+
if (!config.isCordovaServe) {
103+
return next();
104+
}
105+
102106
if (isUserAgentIOS(userAgent)) {
103107
resourcePath = path.join(config.rootDir, IOS_PLATFORM_PATH);
104108
} else if (isUserAgentAndroid(userAgent)) {

src/dev-server/serve-config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface ServeConfig {
66
rootDir: string;
77
wwwDir: string;
88
buildDir: string;
9+
isCordovaServe: boolean;
910
launchBrowser: boolean;
1011
launchLab: boolean;
1112
browserToLaunch: string;

src/serve.ts

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function serve(context?: BuildContext) {
2323
rootDir: context.rootDir,
2424
wwwDir: context.wwwDir,
2525
buildDir: context.buildDir,
26+
isCordovaServe: isCordovaServe(context),
2627
launchBrowser: launchBrowser(context),
2728
launchLab: launchLab(context),
2829
browserToLaunch: browserToLaunch(context),
@@ -99,6 +100,10 @@ function useServerLogs(context: BuildContext) {
99100
return hasConfigValue(context, '--serverlogs', '-s', 'ionic_serverlogs', false);
100101
}
101102

103+
function isCordovaServe(context: BuildContext) {
104+
return hasConfigValue(context, '--iscordovaserve', '-z', 'ionic_cordova_serve', false);
105+
}
106+
102107
function launchBrowser(context: BuildContext) {
103108
return !hasConfigValue(context, '--nobrowser', '-b', 'ionic_launch_browser', false);
104109
}

0 commit comments

Comments
 (0)