lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
582 stars 75 forks source link

How to get bundle output path and file name in custom plugin? #255

Open maxmilton opened 6 years ago

maxmilton commented 6 years ago

I've been working on a plugin for lasso to process CSS via PostCSS (and any arbitarary PostCSS plugins) — https://github.com/WeAreGenki/lasso-postcss. No nice readme yet but I'll work on that soon :sweat_drops:

The basic functionality is working nicely however I'd like to implement source map generation. I saw over in https://github.com/lasso-js/lasso/issues/122 that source maps arn't even a thing for JS... wow. However, I'd still like to hack something together for my plugin. Source maps are simply too powerful a feature to not use!

Inside the plugin export 'class' we have the read() method, which as its first argument get passed the lassoContext. This has a bunch of nice info but nothing about the output destination.

Is there some way to get the bundle's output path and file name (including the fingerprint etc.)? That's all I need to be able to write the source maps.