From 5be36b86e8063a06a7ab2b1a9193f1584574b469 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Thu, 12 Jan 2023 16:07:03 -0500 Subject: [PATCH] doc change (node just deleted their docs on https) --- CHANGELOG.md | 9 ++++++++- scripts/js-api-tests.js | 5 +---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 683e3778d17..b606e267ddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,12 +93,19 @@ At a high level, the breaking changes in this release fix some long-standing iss To enable HTTPS with esbuild: - 1. Generate a self-signed certificate (Node's documentation has some [instructions with example commands](https://nodejs.org/en/knowledge/HTTP/servers/how-to-create-a-HTTPS-server/)) + 1. Generate a self-signed certificate. There are many ways to do this. Here's one way, assuming you have `openssl` installed: + + ``` + openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 9999 -nodes -subj /CN=127.0.0.1 + ``` + 2. Add `--keyfile=key.pem` and `--certfile=cert.pem` to your esbuild development server command 3. Click past the scary warning in your browser when you load your page If you have more complex needs than this, you can still put a proxy in front of esbuild and use that for HTTPS instead. Note that if you see the message "Client sent an HTTP request to an HTTPS server" when you load your page, then you are using the incorrect protocol. Replace `http://` with `https://` in your browser's URL bar. + Keep in mind that esbuild's HTTPS support has nothing to do with security. The only reason esbuild now supports HTTPS is because browsers have made it impossible to do local development with certain modern web features without jumping through these extra hoops. *Please do not use esbuild's development server for anything that needs to be secure.* It's only intended for local development and no considerations have been made for production environments whatsoever. + * Fix `onEnd` not being called in serve mode ([#1384](https://github.com/evanw/esbuild/issues/1384)) Previous releases had a bug where plugin `onEnd` callbacks weren't called when using the top-level `serve()` API. This API no longer exists and the internals have been reimplemented such that `onEnd` callbacks should now always be called at the end of every build. diff --git a/scripts/js-api-tests.js b/scripts/js-api-tests.js index 417a788d122..6ea85cdbdf0 100644 --- a/scripts/js-api-tests.js +++ b/scripts/js-api-tests.js @@ -3840,10 +3840,7 @@ let serveTests = { const keyfile = path.join(testDir, 'key.pem') const certfile = path.join(testDir, 'cert.pem') - const requestFile = path.join(testDir, 'csr.pem') - await run(['openssl', 'genrsa', '-out', keyfile]) - await run(['openssl', 'req', '-new', '-key', keyfile, '-out', requestFile, '-subj', '/CN=127.0.0.1']) - await run(['openssl', 'x509', '-req', '-days', '9999', '-in', requestFile, '-signkey', keyfile, '-out', certfile]) + await run(['openssl', 'req', '-x509', '-newkey', 'rsa:4096', '-keyout', keyfile, '-out', certfile, '-days', '9999', '-nodes', '-subj', '/CN=127.0.0.1']) const input = path.join(testDir, 'in.js') await writeFileAsync(input, `console.log(123)`)