Remix.run Logo
syrusakbary 19 hours ago

We are so deep into the weeds that sometimes is hard for us to realize that maybe we are not explaining in the best terms.

What was the most confusing thing in the blogpost? I'd like to polish a bit more to make it clearer! Thanks a lot!

giankam 18 hours ago | parent [-]

Hi Syrusakbary, I have to admit I still do not fully understand what this is.

First, I could not find usage examples on the edgejs.org page and the docs link points to the node docs, why?

If I head to github, there are some usage examples, but they confuse me more.

The first example: $ edge server.js led me to think that this is a node replacement that runs in a webassembly sandbox, so completely isolated. But why the need of --safe then? What's the difference between using it and not using it?

But the next examples creates more confusion to me: $ edge node myfile.js $ edge npm install $ edge pnpm run dev

What is this doing? I thought that edge was a node replacement, interpreting and running javascript files, but it's now running executables (node, npm)... what is that? What happens when I run npm install... where does it install files? What's the difference between running edge node myfile.js and edge myfile.js?

Hope this helps.

syrusakbary 17 hours ago | parent [-]

> I could not find usage examples on the edgejs.org page and the docs link points to the node docs, why?

This was intentional, as a demonstration that Edge and Node should not diverge a bit. You should be able to replace `node` with `edge` in your terminal and have things running, so that's why we point to the Node.js docs.

> But why the need of --safe then? What's the difference between using it and not using it?

Edge.js currently runs without a sandbox by default. The main reason for this is two fold: native currently performs a bit better than with the Wasm sandbox (about 10-20% better), and because we wanted to polish more the Wasm integration before offering it as default.

> $ edge pnpm run dev > What is this doing?

This is making the `node` alias available for anything that you put after edge. This allows pnpm to use the edge `node` alias instead of your platform node.

Things will be installed as usual, in your `node_modules` directory