esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Self hosting

Open SeasonCCC opened this issue 4 years ago • 4 comments
trafficstars

I have 2 suggestions:

  1. Can you tell us more about how to do self hosting such as using docker?
  2. It is possible to develop a project in node.js ? The reason is because many users are front-end engineer, they are familiar with javascript and node.js.

SeasonCCC avatar Jun 11 '21 08:06 SeasonCCC

  1. They directions in the readme should really be changed to
$ git clone https://github.com/postui/esm.sh
$ cd esm.sh
$ sh ./scripts/build.sh
$ ./scripts/esmd -dev -domain localhost

This is only really help you if you change your source files to look for https://localhost/....

FallingSnow avatar Jun 12 '21 00:06 FallingSnow

Getting this setup as a proxy to esm.sh is a major pain though. I got up to the point where I used import_maps.json to fool deno into going to localhost for esh.sh content. But it kept complaining of being unable to send https traffic to an http address. And deno doesn't have any ability to accept invalid certificates. So the only solution is to give localhost a valid certificate. Oh and the catch to that is it can't be both the CA certificate and domain cert at the same time otherwise you get

TypeError: error sending request for url (https://localhost/[email protected]): error trying to connect: invalid certificate:  CAUsedAsEndEntity

So you need to have a certificate signed by a CA trusted only your PC.

This is where I gave up trying to get this to run in a local environment lol

FallingSnow avatar Jun 12 '21 02:06 FallingSnow

@FallingSnow esm.sh use autotls to get let's encrypted's certificate, in dev you should use http://localhost/...

ije avatar Jun 12 '21 03:06 ije

I'm trying to spoof esm.sh to fix some issues in aleph.

FallingSnow avatar Jun 12 '21 03:06 FallingSnow

there is a offical docker now: https://github.com/esm-dev/esm.sh/pkgs/container/esm.sh

ije avatar Sep 04 '23 10:09 ije