glslify / glslify-require

var src = require('./shader.glsl')

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make it a transform

dy opened this issue · comments

Since now that is a plugin, it is impossible to use this via "browserify" field in package.json.
There does not seem to be blocker making it a transform. @ericmorand what do you think?

Really? Plugins can't be declared in package.json?

Let me check if it possible to have it a transform. There may be a good reaon to have it a plugin but it's been years now so I can't remember.

OK, I checked why it's been made a plugin in the first place and this is due to the fact that a transform can't emit on the browserify pipeline - and thus can't emit dependencies involved in the bundle process.

Maybe when can have glslify-require comes in two flavors: a transform as the main entry point and a plugin that would need to be required explicitely (think glslify-require/plugin) that would provide dependencies emiting. Thus, middlewares could require the plugin while people with simpler needs could use the transform - either via the API or package.json.

That would of course be a breaking change and thus a 2.x milestone.

What do you think?

@ericmorand agreed, makes sense to make transform a default entry, as browserify does for its "browser" field. Then we would be able to use that directly from browser.