Skip to content

Commit bff8c9e

Browse files
committed
feature #1118 Use cli param server-type to define devServer https mode (thegillou)
This PR was merged into the main branch. Discussion ---------- Use cli param server-type to define devServer https mode Check also the serverType cli param to define if the devServer is in https mode Commits ------- 8926a47 Check server-type cli param to define if the dev-server is in https mode
2 parents 5322a03 + 8926a47 commit bff8c9e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/config/parse-runtime.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ module.exports = function(argv, cwd) {
4141
runtimeConfig.verbose = true;
4242

4343
runtimeConfig.useDevServer = true;
44-
runtimeConfig.devServerHttps = argv.https;
4544
runtimeConfig.devServerKeepPublicPath = argv.keepPublicPath || false;
4645

46+
if (argv.https || argv.serverType === 'https') {
47+
runtimeConfig.devServerHttps = true;
48+
}
49+
4750
if (typeof argv.public === 'string') {
4851
runtimeConfig.devServerPublic = argv.public;
4952
}

test/config/parse-runtime.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('parse-runtime', () => {
8080
expect(config.environment).to.equal('dev');
8181
expect(config.devServerHost).to.equal('foohost.l');
8282
expect(config.devServerPort).to.equal(9999);
83-
expect(config.devServerHttps).to.be.undefined;
83+
expect(config.devServerHttps).to.be.null;
8484
});
8585

8686
it('dev-server command https', () => {
@@ -93,6 +93,16 @@ describe('parse-runtime', () => {
9393
expect(config.devServerHttps).to.equal(true);
9494
});
9595

96+
it('dev-server command server-type https', () => {
97+
const testDir = createTestDirectory();
98+
const config = parseArgv(createArgv(['dev-server', '--server-type', 'https', '--host', 'foohost.l', '--port', '9999']), testDir);
99+
100+
expect(config.useDevServer).to.be.true;
101+
expect(config.devServerHost).to.equal('foohost.l');
102+
expect(config.devServerPort).to.equal(9999);
103+
expect(config.devServerHttps).to.equal(true);
104+
});
105+
96106
it('dev-server command public', () => {
97107
const testDir = createTestDirectory();
98108
const config = parseArgv(createArgv(['dev-server', '--public', 'https://my-domain:8080']), testDir);

0 commit comments

Comments
 (0)