Skip to content

Commit 33da174

Browse files
louismariegaboritweaverryan
authored andcommitted
Revert removing public option
1 parent 9e1528e commit 33da174

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

bin/encore.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ process.argv.splice(2, 1);
3333
const encoreOnlyArguments = new Set(['--keep-public-path']);
3434
process.argv = process.argv.filter(arg => !encoreOnlyArguments.has(arg));
3535

36+
// remove argument --public not supported by webpack/dev-server
37+
const indexPublicArgument = process.argv.indexOf('--public');
38+
if (indexPublicArgument !== -1) {
39+
process.argv.splice(indexPublicArgument, 2);
40+
}
41+
3642
if (!runtimeConfig.isValidCommand) {
3743
if (runtimeConfig.command) {
3844
console.log(chalk.bgRed.white(`Invalid command "${runtimeConfig.command}"`));
@@ -78,6 +84,7 @@ function showUsageInstructions() {
7884
console.log(` - ${chalk.yellow('--host')} The hostname/ip address the webpack-dev-server will bind to`);
7985
console.log(` - ${chalk.yellow('--port')} The port the webpack-dev-server will bind to`);
8086
console.log(` - ${chalk.yellow('--keep-public-path')} Do not change the public path (it is usually prefixed by the dev server URL)`);
87+
console.log(` - ${chalk.yellow('--public')} The public url for entry asset in entrypoints.json`);
8188
console.log(' - Supports any webpack-dev-server options');
8289
console.log();
8390
console.log(` ${chalk.green('production')} : runs webpack for production`);

lib/config/parse-runtime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ module.exports = function(argv, cwd) {
4444
runtimeConfig.devServerHttps = argv.https;
4545
runtimeConfig.devServerKeepPublicPath = argv.keepPublicPath || false;
4646

47-
if (typeof argv['client-web-socket-url'] === 'string') {
48-
runtimeConfig.devServerPublic = argv['client-web-socket-url'];
47+
if (typeof argv.public === 'string') {
48+
runtimeConfig.devServerPublic = argv.public;
4949
}
5050

5151
runtimeConfig.devServerHost = argv.host ? argv.host : 'localhost';

test/config/parse-runtime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ describe('parse-runtime', () => {
9393
expect(config.devServerHttps).to.equal(true);
9494
});
9595

96-
it('dev-server command client-web-socket-url', () => {
96+
it('dev-server command public', () => {
9797
const testDir = createTestDirectory();
98-
const config = parseArgv(createArgv(['dev-server', '--client-web-socket-url', 'https://my-domain:8080']), testDir);
98+
const config = parseArgv(createArgv(['dev-server', '--public', 'https://my-domain:8080']), testDir);
9999

100100
expect(config.devServerPublic).to.equal('https://my-domain:8080');
101101
});

0 commit comments

Comments
 (0)