webpack-contrib / imports-loader

Imports Loader
MIT License
520 stars 63 forks source link

Allow custom arguments inside (function(){ ... }).call(window) #56

Closed julianxhokaxhiu closed 4 years ago

julianxhokaxhiu commented 7 years ago

Hi,

I was trying to accomplish something amazing with this library, but I found out that I got blocked by one simple task that could enhance a lot this library.

What I need basically is a way to expand the IIFE with custom arguments, see https://github.com/webpack-contrib/imports-loader/blob/master/index.js#L26

These two blocks would be really awesome if there could be a way to configure which argument will take in and which one could be passed in the .call.

Can you please think about a way? I will see if I will be able to do a PR maybe tomorrow.

Thank you and best regards, Julian

julianxhokaxhiu commented 7 years ago

PR done!

cap-Bernardito commented 4 years ago

You can use with wrapper option additionalCode option to determine the variables you need. Variables declared in this way will be accessible inside wrapper.