Skip to content

open option doesn't work in API mode #1722

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

Closed
1 of 2 tasks
guoyunhe opened this issue Mar 17, 2019 · 2 comments
Closed
1 of 2 tasks

open option doesn't work in API mode #1722

guoyunhe opened this issue Mar 17, 2019 · 2 comments

Comments

@guoyunhe
Copy link

  • Operating System: Linux
  • Node Version: 10.15.2
  • NPM Version: 6.9.0
  • webpack Version: 4.29.6
  • webpack-dev-server Version: 3.3.0
  • This is a bug
  • This is a modification request

Code

// webpack.config.js

'use strict';

// our setup function adds behind-the-scenes bits to the config that all of our
// examples need
const { setup } = require('../../util');

module.exports = setup({
  context: __dirname,
  entry: ['./app.js', '../../../client/index.js?http://localhost:8080/'],
  output: {
    filename: 'bundle.js',
  },
});
// scripts/start.js
'use strict';

const Webpack = require('webpack');
const WebpackDevServer = require('../../../lib/Server');
const webpackConfig = require('./webpack.config');

const compiler = Webpack(webpackConfig);
const devServerOptions = Object.assign({}, webpackConfig.devServer, {
  open: true,
  stats: {
    colors: true,
  },
});
const server = new WebpackDevServer(compiler, devServerOptions);

server.listen(8080, '127.0.0.1', () => {
  console.log('Starting server on http://localhost:8080');
});

Expected Behavior

Running the script should open browser.

Actual Behavior

Browser is not opened.

For Bugs; How can we reproduce the behavior?

git clone [email protected]:guoyunhe/webpack-dev-server.git
cd webpack-dev-server
npm install
cd examples/api/simple
node server.js

For Features; What is the motivation and/or use-case for the feature?

@alexander-akait
Copy link
Member

Thanks for issue, duplicate #1540, Feel free to send a PR

@alexander-akait
Copy link
Member

Thanks for issue, duplicate #1510, Feel free to send a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants