How to work with "npm link" with @babylonjs?

I have directory

/node_modules — by default
/local_node_modules — I made it

and wanna use @babylonjs/core from local directory as it explained in article How to NPM Link to a local version of your dependency | by _Aid(); | Medium

So as I readed I should open “/local_node_modules/@babylonjs” and run git clone GitHub - BabylonJS/Babylon.js: Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.

But! File structure in the repository and my folder ("/node_modules/@babylonjs/core") doesnt match. It looks like in the node modules folder I have content from Babylon.js/src at master · BabylonJS/Babylon.js · GitHub

Does anyone know how I can make local copy of @babylonjs/core to custom it for my project?

fork the project and locally run a full build with npm run build this will deploy as npm link all the babylon libs.

Then in any other projects just use npm link @babylonjs/… to reuse the local one

1 Like

Thank you for answer!
I has question about license. As I can see it is Apache 2.0 and I should state changes.

How it can be implemented? Push changes to public fork of repo?

This is a good question as I thought we picked apache 2.0 so you can do whatever you want with it :slight_smile:

Obviously we like when users add a little thanks somewhere but nothing is mandatory.

Adding @Deltakosh to confirm

1 Like

Seb is right, you can do the heck you want even though we appreciate when people can contribute back


My friends, I’sorry, but I still confused to use “npm link” with babylonjs. If you can pleas check my actions and comment it where I was mistakes:

  1. Create folder structure
  1. run cd ./node_modules_local
  2. run git clone %path to my fork of babylonjs%
  3. run cd ./@babylonjs
  4. do all staff from guide to contributor until to npm run build in Tools\Gulp (build was succeffuly finished)
  5. go to ./node_modules_local/@babylonjs
  6. run npm link
  7. go to “/my-project”
  8. run npm link "@babylonjs" and got error
$ npm link "@babylonjs"
npm ERR! Invalid tag name "@babylonjs": Tags may not have any characters that encodeURIComponent encodes.

I did similar actions with other library (fabric.js) and all was fine. I think this actions dont full appyable to scoped packages maybe. Have you idea about?

Sorry, it was close =)
npm link @babylonjs/core works fine!

yup and you should not need step 6 and 7 as the build should do it for you