matt-ball / postman-local

A client to facilitate local development of scripts for Postman.
Apache License 2.0
70 stars 6 forks source link

Improve bundling #12

Open matt-ball opened 4 years ago

matt-ball commented 4 years ago

Bundling happens on a per request level meaning libraries may be imported multiple times.

kevinswiber commented 4 years ago

We could potentially copy the approach of this template: https://explore.postman.com/templates/7170/browserify-cdn-modules.

Look at the collection pre-request script. We can make it a bit less complex by assuming variables are only at the collection level and assuming variable values are already populated (because we own Browserify bundling in this case).

We'd have to alter each script that has dependencies to be prefixed with:

 new Function(pm.variables.get('init'))(pm);

But it's less intrusive than the raw Browserify bundle.