remoteinterview / zero

Zero is a web server to simplify web development.

Home Page:https://zeroserver.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modules should be installed in local node_modules

schtauffen opened this issue · comments

Setup:
I created a .ts file with the "time" example from the docs utilizing moment.
I then run zero

Expected:
VSCode should be able to peek and see that moment was installed

Actual:
moment has a red squiggle with "cannot find moment..." error message

Alternatively, there should be a way to turn off auto-installing of modules in order to ensure you manually install everything required.

This happens because of how zero works. It makes a copy of project in system’s tmp directory, where it adds package.json, node_modules, babelrc, etc. This way project directory remains clean. Until someone wants to override those configs.

I do agree that this sucks for typescript. I wonder if there is an alternative approach to make editor point to that tmp directory.

using an alternative like nextjs or most packages i know/used to create a hidden folder like .gatsby or .next would be okay?
It would probably solve the issue with dependencies without breaking all the dependencies.
We use a monorepo with dependencies listed as file:path_to_dependencies
and it's breaking most of it when it's copied by zero.
if we can stay in the same repo that would be nice. maybe as a config with the possibility of disabling auto install ?

Even if i don't know how we could keep both way since doing it inside a hidden folder would make a lot of the overhead non necessary like copy/pasting/ installing dependencies, etc

Or copy pasting into tmp folder has other reason except keeping the repo "clean"?

Can you try the latest beta npm i -g zero@beta. It now installs and builds everything inside .zero folder (as you have brilliantly suggested too). The dependencies are inside this folder too. The file: format would work but will need an additional ../ I suppose.

It's a compromise right now. The original idea was to keep the main repository clean but as you mentioned, the overhead is too much specially as the project grows (which we are noticing in our projects too).

I am looking into avoiding most copy/pasting and only keeping (temp) bundle files inside the .zero folder.

hi, I saw in master the change so I tried the alpha version. zero is not updating the path in the package.json when copy pasting it.
Would it be possible to use the default package.json instead of copy pasting it?
the auto install of dependencies I guess is a reason maybe? in out repo, we'd rather deactivate that option if that was possible.

the beta is still not working. I'll try a bit more and try to understand what's not working for us so we can try to find a solution :)

This is solved in v1.1. Zero doesn't make a copy of project into another temp folder anymore.