You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you’re interested, it should be trivial to incorporate Auto Encrypt Localhost to make it so that it’s automatic. (I wrote this for and I’m using it in Site.js).
Basically, it’s as simple as this:
// const server = https.createServer(…) becomesconstserver=AutoEncryptLocalhost.https.createServer(…)
(That handles all the mkcert stuff behind the scenes.)
Note: it also bundles the mkcert binaries which is fine for Site.js as I ship a binary and strip out the ones for the other platforms but note that a reason you may not want to use it in Snowpack is the bundle size increase during development. Regardless, thought I’d mention it in case it’s useful.
Love what you’re doing with Snowpack, by the way, and I’m looking into how to integrate it into Site.js alongside Svelte. I was initially excited when I saw the conversations around exposing it as Express middleware but I see now that that’s been implemented in an inverted manner (so you can supply middleware to Snowpack). That’s not going to work for Site.js as it needs to control the server but I’m going to keep thinking about it :) (Might be as easy as integrating build --watch into the workflow…)
PS. The other thing Auto Encrypt Localhost does is to serve the public certificate at a well-known URL so that you can test over HTTPS from other devices on your local area network via IP address while having a convenient way to install the certificate on other devices (like iPhones, etc.) This removes the need to use a service like PageKite or ngrok just to do multi-device testing with secure servers on your local area network. (You still need them if you need to do remote testing, of course.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Heya,
Was just browsing the source when I saw that generating certificates is currently a manual process (https://github.com/snowpackjs/snowpack/blob/master/snowpack/src/commands/dev.ts#L413).
If you’re interested, it should be trivial to incorporate Auto Encrypt Localhost to make it so that it’s automatic. (I wrote this for and I’m using it in Site.js).
Basically, it’s as simple as this:
(That handles all the mkcert stuff behind the scenes.)
Note: it also bundles the mkcert binaries which is fine for Site.js as I ship a binary and strip out the ones for the other platforms but note that a reason you may not want to use it in Snowpack is the bundle size increase during development. Regardless, thought I’d mention it in case it’s useful.
Love what you’re doing with Snowpack, by the way, and I’m looking into how to integrate it into Site.js alongside Svelte. I was initially excited when I saw the conversations around exposing it as Express middleware but I see now that that’s been implemented in an inverted manner (so you can supply middleware to Snowpack). That’s not going to work for Site.js as it needs to control the server but I’m going to keep thinking about it :) (Might be as easy as integrating
build --watch
into the workflow…)PS. The other thing Auto Encrypt Localhost does is to serve the public certificate at a well-known URL so that you can test over HTTPS from other devices on your local area network via IP address while having a convenient way to install the certificate on other devices (like iPhones, etc.) This removes the need to use a service like PageKite or ngrok just to do multi-device testing with secure servers on your local area network. (You still need them if you need to do remote testing, of course.)
Beta Was this translation helpful? Give feedback.
All reactions