Bundling Packages

About a year ago, we had this discussion on how to improve package activation time through bundling. The other day, I’ve noticed that the Visual Studio Code team seems to agree:

I’ve updated by Yeoman generators for Atom packages written in CoffeeScript and TypeScript, they now default to being compiled with Webpack.

Please let me know how these work for you!

3 Likes

Does the Webpack compiling actually function for Atom right now? I’ve been looking into package management, and apm basically clones the source off the repo as it was when the version tag was created. This asset cannot be changed either.

To get around this I have been experimenting with an alternative package manager. apx supports publishing like a complete npm package (and if it skips any steps, that’s a bug). If you also use apx to install the package, it will first check if such a bundle is available on GitHub before using the source code.

You could either force users install via apx, or design your package and publish procedure such that both the custom bundle and the source code will both run correctly (but have the bundle cut the redundant files, like tests, and webpacked). In particular, I find it useful for TypeScript packages; no worrying about anything on the user end.

I’m not sure if I understand the question correctly. Neither Atom, nor Visual Studio Code bundle the package source at install-time. Ideally, that would be the case, just like CoffeeScript packages get transpiled automatically. Maybe there are too many factors (loaders, Babel plugins) that prevent this from happening.

As for my own Yeoman generators for Atom, they offer two options:

  1. bundle at prepublishOnly (default)

  2. bundle at post-install – this has a couple of disadvantages, devDependencies don’t get installed and including webpack et al as a normal dependency adds too ”unnecessary” files and slows down the installation

Sorry, I didn’t mean to doubt it, I was just trying to work out what they did and how they fit in.

I was thinking they were to be used by the developer, and wasn’t sure how the user would install what had been made by the prepublishOnly script. That’s what I meant when I asked if webpack was working, if those packages were uploading the packed package & installing it on the users end.