Skip to content

webpack-dev-server/client required twice and second time without correct options #1387

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
jameshartig opened this issue Aug 26, 2020 · 1 comment

Comments

@jameshartig
Copy link

Do you want to request a feature or report a bug?

Report a bug

What is the current behaviour?

webpack-dev-server/client is included twice and the second time without the correct options leading to needless errors in the console and failed network calls when a path is specified:

__webpack_require__("../node_modules/webpack-dev-server/client/index.js?https://mydomain.com/path&sockPath=/path/sockjs-node");
__webpack_require__("../node_modules/webpack/hot/dev-server.js");
__webpack_require__("../node_modules/preact-cli/lib/lib/entry.js");
__webpack_require__("../node_modules/webpack-dev-server/client/index.js");
module.exports = __webpack_require__(/*! webpack/hot/dev-server */"../node_modules/webpack/hot/dev-server.js");

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

1) npx preact-cli create default my-project
2) cd my-project
3) npm run dev
Observe:
__webpack_require__("../node_modules/webpack-dev-server/client/index.js?http://0.0.0.0:8080");
__webpack_require__("../node_modules/webpack/hot/dev-server.js");
__webpack_require__("../node_modules/preact-cli/lib/lib/entry.js");
__webpack_require__("../node_modules/webpack-dev-server/client/index.js");
module.exports = __webpack_require__(/*! webpack/hot/dev-server */"../node_modules/webpack/hot/dev-server.js");

What is the expected behaviour?

I expect it to only be included once and with the correct options.

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.

See: webpack/webpack-dev-server#711

It seems like we can just remove the whole block from webpack-client-config.js:

	if (!isProd) {
		entry.bundle = [
			entry.bundle,
			'webpack-dev-server/client',
			'webpack/hot/dev-server',
		];
	}

Please paste the results of preact info here.

Environment Info:
  System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 14.8.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.4 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.423.0), Chromium (84.0.522.63)
  npmPackages:
    preact: ^10.3.2 => 10.4.7
    preact-cli: ^3.0.0 => 3.0.1
    preact-render-to-string: ^5.1.4 => 5.1.10
    preact-router: ^3.2.1 => 3.2.1
@jameshartig
Copy link
Author

Fixed in #1395

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.

1 participant