teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
63 stars 9 forks source link

Use `capsule.execNode` for faster build performance #48

Open imsnif opened 4 years ago

imsnif commented 4 years ago

Now that https://github.com/teambit/bit/pull/2162 has been released, it would be great if this compiler can use the new system.

What this would require:

  1. Passing two new options to the isolate function:
    • skipNodeModules: true - the package manager will not be run in the isolated environment
    • keepExistingCapsule: true - the isolated environment will not be deleted.
  2. Using the capsule.execNode API method to read node_modules from memory.
  3. Using a deterministic name for the isolated environment* - I recommend an md5 of: host-project-name + component-name + component-version.

This will allow us to re-use the isolated environment - so note that any state written into the environment will be persisted. It will significantly improve the build performance.

You can see an example implementation of all the above in the build-performance branch.

*this logic should be moved to Bit at some point

qballer commented 4 years ago

I've added useExperimentalCache:false by trying to get quick win, but it didn't work out yet. Will continue this after working on jest.