Using local BJS repo

Sorry if this has been asked before… How can I use a local BJS repo in my project?

I’ve made some changes in ~/Babylon.js, and built them with npm run build:dev. The ~/Babylonjs/packages/dev/core/dist directory has the updated files, but how to get ~/myproj to use this build?

Here’s ~/myproj/package.json:

"dependencies": {
  "@babylonjs/core": "../Babylon.js"
}

After npm ci, the node_modules/@babylonjs directory exists, but it doesn’t have my changes.

I’ve hacked around this by copying the updated files to node_modules, but there has to be a better way

cc @RaananW

npm-link to the rescue.

The process is described here - Start Contributing to Babylon.js | Babylon.js Documentation, search for " Link a public project to an external one" (sadly i can’t provide a direct link to this part of the docs). You don’t need to run the prepublish step, this is now done automatically for you.

In general - you can use npm-link to link any public package using this method.

1 Like