What I’ve been trying to figure out and cannot find a proper explanation of is how to take advantage of package.json and node_modules in Cocos Creator.
I’ve seen implementations where you have Scripts/libs/third-party-library.js but this is not what I want. I want to take advantage of package.json and node_modules.
I use TypeScript and I would like to be able to import only the pieces I use and not full libraries. A good example is the huge library RxJS, I only want to load the functionality I use from it. Same goes for Lodash etc.
A few questions:
- Am I required to have third party libraries in Assets folder?
- If I download packages to a node_modules folder inside of Assets, Cocos creator will go crazy from so many new files. How should I build up the folder structure to be able to work with node_modules third party libraries?
- I read about plugin scripts (https://github.com/cocos-creator/creator-docs/blob/master/en/scripting/plugin-scripts.md). It says I cannot reference to a plugin script from a component script. Seems plugin scripts has to be globally available, I don’t like that.
Please help, I cannot find a good solution and otherwise Cocos Creator is amazing!