electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 98 forks source link

Generic transforms #17

Open mattdesl opened 9 years ago

mattdesl commented 9 years ago

This is a pretty cool module!

I have a use case like this:

Specifically, I am thinking about using insert-module-globals to fix https://github.com/atom/electron/issues/421, but the same feature could be used for any sort of cool transforms.

Does your protocol-hook handle something like this? Could it be abstracted into another lower-level module?

anaisbetts commented 9 years ago

I want Electron to run a source transform on every file when node-integration is set up (transparently so that it just works when a user includes a script tag)

We already do this :)

Does your protocol-hook handle something like this? Could it be abstracted into another lower-level module?

This isn't so easy because we have to propagate the settings you set up in the browser process over to the renderer process, so including a "I want to write a function that rewrites any XYZ file" type-thing can't be done, because we can't blit your browser-process function over to new renderers.

I would instead try to create a custom Compiler (which isn't very well documented, sorry) to replace one that's built-in, and delegate to it.