guardian / scribe-plugin-noting

9 stars 3 forks source link

Clean up build output - named AMD module & remove shared deps. #129

Open dustyjewett opened 9 years ago

dustyjewett commented 9 years ago

Though the main scribe project can be installed via bower and used as AMD, this project doesn't seem to be constructed in the same way. If it IS intended to be used the same way, the bower installed package seems to be broken. It does not export any AMD modules (no "define('packageName')").

The larger, stranger issue is that the parent project is AMD, while this is CommonJS.

robinedman commented 9 years ago

Hi there! You're right that it's constructed differently. Did you try the steps in the README? That will build an AMD bundle for you.

dustyjewett commented 9 years ago

The problem that I'm having seems to be with the proliferation of technologies used. I'm attempting to use Scribe in an Ember project, which uses ES6 natively, with the ability to import AMD Libraries or vanilla-js (global.LibraryName) fairly seamlessly. Scribe depends on Facebook's Immutable library, which is actually a UMD library. This is imported into -noting, and everything is browserified then AMDified, but as an anonymous module instead of as a named module.

What I end up with is multiple copies of lodash and Immutable, because they're compiled into the -noting.js file. Lodash uses AMD, Immutable uses UMD, and -noting uses browserify. My project uses ES6, and can pull in any one of these independently, but dies when all three are used in the same file. As a fallback, it can also support using globals, but -noting doesn't export as a global unlike Scribe.

While I think that asking for internal consistency (module systems, build tools, etc) among guardian projects is entirely reasonable, I recognize the immense amount of work to change one or another of the projects.

That said, unless it is possible to build out a better project, the overhead of maintaining multiple ways to import projects, and the extra size incurred by having multiple copies of Immutable and Lodash are too much for my project to handle.

rrees commented 9 years ago

Hi @dustyjewett can I ask what you're using the plugin for?

We thought this was one of the gnarliest internal modules and we haven't open-sourced it because we didn't want to take external requirements into account on it.