1

I wrote an editor in HTML/JS that I want to use for multiple Electron based applications and a website.

For testing purposes I have package all dependencies, some are npm modules, some are font files, some are images, into a single file using browserify. For development I find this quite attractive as npm take care of keeping the packages up-to-date and browserify build even things like images and CSS into a single JS file. And included this bundle using a script tag in a html file.

Now I would love to get this onto npm to use as a dependency for other projects. But frankly I am at a loos as to how to do this.

Some blogs suggest to use:

module.exports = mymodule

But I want people and myself to be able to either get a single file and insert it using a script tag to get a global function to start my editor as well as require it using npm for Electron based apps.

startEditor = require('mymodule')

<script src="path/to/mymodule"></script>

Should both be valid ways to use the editor.

You can see the current state of the project on GitHub

Jens Habegger
  • 5,266
  • 41
  • 57
H_end-rik
  • 551
  • 1
  • 6
  • 19
  • [does this help?](http://stackoverflow.com/a/38208213/2670182) – Cool Blue Jul 05 '16 at 17:47
  • @CoolBlue Could do that I guess. But really I would love to run browserify and end up with something that people can then use either way without having to do more set-up (like using shim) themselves. – H_end-rik Jul 06 '16 at 01:49

0 Answers0