packages/cli: open browser at correct path when serving bundle

This commit is contained in:
Patrik Oldsberg
2020-06-06 15:54:48 +02:00
parent 49d67d997a
commit 2edcd94793
3 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -61,7 +61,7 @@
"ora": "^4.0.3",
"raw-loader": "^4.0.1",
"react": "^16.0.0",
"react-dev-utils": "^10.2.0",
"react-dev-utils": "^10.2.1",
"react-hot-loader": "^4.12.21",
"recursive-readdir": "^2.2.2",
"replace-in-file": "^6.0.0",
+13 -1
View File
@@ -34,7 +34,6 @@ export async function serveBundle(options: ServeOptions) {
}
const protocol = yn(process.env.HTTPS, { default: false }) ? 'https' : 'http';
const urls = prepareUrls(protocol, host, port);
const paths = resolveBundlingPaths(options);
const pkgPath = paths.targetPackageJson;
@@ -63,6 +62,19 @@ export async function serveBundle(options: ServeOptions) {
return;
}
// TODO: This signature is available in 10.2.1 but doesn't have types published yet
const latestPrepareUrls = prepareUrls as (
protocol: string,
host: string,
port: number,
path?: string,
) => ReturnType<typeof prepareUrls>;
const urls = latestPrepareUrls(
protocol,
host,
port,
config.output?.publicPath,
);
openBrowser(urls.localUrlForBrowser);
resolve();
});
+1 -1
View File
@@ -15257,7 +15257,7 @@ react-clientside-effect@^1.2.2:
dependencies:
"@babel/runtime" "^7.0.0"
react-dev-utils@^10.2.0:
react-dev-utils@^10.2.1:
version "10.2.1"
resolved "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-10.2.1.tgz#f6de325ae25fa4d546d09df4bb1befdc6dd19c19"
integrity sha512-XxTbgJnYZmxuPtY3y/UV0D8/65NKkmaia4rXzViknVnZeVlklSh8u6TnaEYPfAi/Gh1TP4mEOXHI6jQOPbeakQ==