Skip to content

Revert removing public option #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bin/encore.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ process.argv.splice(2, 1);
const encoreOnlyArguments = new Set(['--keep-public-path']);
process.argv = process.argv.filter(arg => !encoreOnlyArguments.has(arg));

// remove argument --public not supported by webpack/dev-server
const indexPublicArgument = process.argv.indexOf('--public');
if (indexPublicArgument !== -1) {
process.argv.splice(indexPublicArgument, 2);
}

if (!runtimeConfig.isValidCommand) {
if (runtimeConfig.command) {
console.log(chalk.bgRed.white(`Invalid command "${runtimeConfig.command}"`));
Expand Down Expand Up @@ -78,6 +84,7 @@ function showUsageInstructions() {
console.log(` - ${chalk.yellow('--host')} The hostname/ip address the webpack-dev-server will bind to`);
console.log(` - ${chalk.yellow('--port')} The port the webpack-dev-server will bind to`);
console.log(` - ${chalk.yellow('--keep-public-path')} Do not change the public path (it is usually prefixed by the dev server URL)`);
console.log(` - ${chalk.yellow('--public')} The public url for entry asset in entrypoints.json`);
console.log(' - Supports any webpack-dev-server options');
console.log();
console.log(` ${chalk.green('production')} : runs webpack for production`);
Expand Down
4 changes: 2 additions & 2 deletions lib/config/parse-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module.exports = function(argv, cwd) {
runtimeConfig.devServerHttps = argv.https;
runtimeConfig.devServerKeepPublicPath = argv.keepPublicPath || false;

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

runtimeConfig.devServerHost = argv.host ? argv.host : 'localhost';
Expand Down
4 changes: 2 additions & 2 deletions test/config/parse-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ describe('parse-runtime', () => {
expect(config.devServerHttps).to.equal(true);
});

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

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