Intelligent meteorite pack for the entire library?

I am interested in creating a smart package for the excellent three.js 3D library. It mainly consists of hundreds of different JavaScript files - only some of them can be used for a simple application.

AFAIK, the smart package pushes its JavaScript files to the client using the add_files method in the Package.on_use callback. If I was going to combine this entire library in an intellectual package, is there any way for the client to indicate which components he needs for any given project, or will I mainly have to configure a separate intellectual package for each possible permutation of the necessary components?

+4
source share
1 answer

Well, neither Meteorite nor the Smart Packet APIs will directly support this AFAIK.

There are three options:

  • If this is for other users, you can have a page somewhere that builds a package for users (see what Boost does on its website).

  • Just do not use a smart package. Put all the JavaScript files in your public directory and use jquery to download them individually.

  • You can split the three.js project into many smart packages, put the dummy package in the packages directory, and use the api.use(...) function to include each component that you need.

Just keep in mind that the three .js are already in the atmosphere, and if the next thought crossed your mind, you should avoid putting hundreds of tiny interconnected subpackages into the atmosphere.

And technically add_files is to add files for installation to the kit before starting the server or deployment, it does not directly transfer files to the client.

+4
source

Source: https://habr.com/ru/post/1490091/


All Articles