Skip to content
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

Webpack 5 --open-page / devServer.openPage not opening page #2993

Closed
JasonGore opened this issue Feb 5, 2021 · 9 comments · Fixed by #3032
Closed

Webpack 5 --open-page / devServer.openPage not opening page #2993

JasonGore opened this issue Feb 5, 2021 · 9 comments · Fixed by #3032

Comments

@JasonGore
Copy link

Bug report

I've been updating our projects from webpack 4 to webpack 5 and noticed that webpack-dev-server configs stopped opening browser pages on launch entirely.

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce.

  1. git clone https://github.com/JasonGore/webpack-dev-server-openpage.git
  2. npm install
  3. npm run dev

Project uses both devServer.openPage config and --open-page argument.

What is the expected behavior?

Page should open in browser as it does with webpack 4 / webpack-dev-server 3 per webpack documentation on devServer.openPage and --open-page.

Other relevant information:
webpack version: 5.20.2
Node.js version: v12.18.2
Operating System: Windows 10
Additional tools:
webpack-cli: 4.5.0
webpack-dev-server: 3.11.2
Versions in https://github.com/JasonGore/webpack-dev-server-openpage/blob/main/package-lock.json

@webpack-bot
Copy link

webpack-bot commented Feb 5, 2021

For maintainers only:

  • webpack-4
  • webpack-5
  • bug
  • critical-bug
  • enhancement
  • documentation
  • performance
  • dependencies
  • question

@sokra sokra transferred this issue from webpack/webpack Feb 5, 2021
@JasonGore
Copy link
Author

JasonGore commented Feb 5, 2021

Ok well apparently the change in webpack 5 behavior is that either --open or devServer.open is now also required. This is why pages stopped opening for me. Supplying either in my repro seems to fix the issue and open pages.

I'm not sure if this is an intentional change, but it seems to me that providing a configuration openPage should automatically imply open as being true.

@alexander-akait
Copy link
Member

Not related to webpack v4 or v5, it always worked like before, nothing was changed

@JasonGore
Copy link
Author

If you look at my repro, you do not need open for webpack v4, but is now required for v5.

@alexander-akait
Copy link
Member

No, webpack don't know --open option

@JasonGore
Copy link
Author

I'm talking about devServer.open.

@alexander-akait
Copy link
Member

@snitin315 Also need look at this --open-page should open browserm like the --open option

@snitin315
Copy link
Member

I will take a look 👍.

@dennisbot
Copy link

This feature seems to be missing in WDS v4.8.1, although, I can provide a path in open property instead of a boolean e.g. open: /my-target-page and it will open up at that location.

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

Successfully merging a pull request may close this issue.

5 participants