-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grunt-Browserify v2 #109
Comments
@jmreidy thanks for getting this rolling. How 'bout some development time speedups, like:
|
@hurrymaplelad Good ideas. I made an attempt on sharing the browserify cache across bundles awhile ago, and ran into some odd behavior - but that was before watchify even existed, so I'm game to trying again. |
👍 (unfortunately I don't have the bandwidth to contribute, just cheering you guys on!) |
I have a fork of this module that works alone with epeli/browserify-externalize, that is kinda a kludge due to this module being a huge function full of if functions. Also might be a useful feature push upstream. |
There's a working beta version of v2 on NPM, which can be installed by specifying '2.0' in package.json. Currently it works exactly the same as v1.x, but with an internal rewrite and watchify support. Use option |
Too late to ask for exorcist support in v2? https://github.com/thlorenz/exorcist |
+10 |
Doesn't this work already just by supplying a transform? |
@jmreidy Ha! Yeah... I suppose it would. Whoops. |
Not to hijack this issue with Exorcist stuff, but, using it as a transform doesn't work since it's a post bundle op (unless i'm missing something, which is possible). So, I ended up writing this: https://github.com/mikefrey/grunt-exorcise If you feel like pulling it into grunt-browserify, by all means do so. Otherwise I'll just maintain it independently. Big thanks for a great module! |
@mikefrey Did you try using the postBundleCB option? https://github.com/jmreidy/grunt-browserify#postbundlecb |
@jmreidy Yes, but I felt that given the amount of configuration that could go into it, and the stream-y nature of Exorcist, it would be better served as it's own grunt task that can be shared. |
I've been thinking a good amount about grunt-browserify and its future, and I think it needs to be simplified. A lot. What does a simplified grunt-browserify look like?
So that's where things are going - and where they will be shortly! |
@jmreidy Externalizing might be easier in the future with native browserify, with the |
@terinjokes sweet. That looks awesome. Having grunt-browserify focus on arranging browserify file lists, plugins, and transforms seems like the right direction. |
After playing with /cc @bclinkinbeard |
👍
That actually sounds like a great idea, and it could probably be assembled almost entirely from existing modules. |
Can't aliasMappings just be done as a resolve function? |
I created a quick module to do alias mappings: https://github.com/joeybaker/remapify @terinjokes yes, it probably could be a resolve function, but I find having a bit of structure around the process nice. IMO. |
So I bit the bullet and rewrote the task from scratch. A key thing for me was to make the tests more intuitive; the need to create fixture files and compare Grunt output to the fixtures felt brittle, and certainly added a good deal of complexity. The new code has extrapolated the grunt task into its own runner, with grunt functionality injected into it. That means that the test code can properly exercise the runner's API without all of the fixture nonsense. The runner itself has been dramatically simplified in favor of sticking as close to browserify as possible. When I originally wrote this task, the rich ecosystem of browserify transforms didn't yet exist, and plugins weren't even a feature. Now that there's so many browserify-based modules out there, I don't think a grunt task should bother reinventing the wheel. Take a look at where things are at with |
I like the simplified approach, however I think you could take it one step further. Everything I can specify in So to keep it simple it'd be better to stick to bare browserify APIs where possible and only reinvent APIs when that results in a significant gain. |
@thlorenz I think, in general, that there's a browserify way of doing things, and a grunt way of doing things. As a grunt task that's using browserify, this project has to walk the line of both conventions. I completely agree with you that the browserify approach has focused on using package.json to specify options. But that approach is atypical in grunt-land. Since this task is meant for grunt, I'm going to keep configuration in the Gruntfile. That said, if there's a lot of confusion down the road, I'd be more than happy to change this approach; the current rewrite will make changes much, much easier. |
@jmreidy understood. Maybe even a section in the documentation (or a blog post) that shows both ways to configure things side by side for an example project. |
@thlorenz I think that's a really good idea. |
@terinjokes the remapify lib can be used with transform? |
One thing that's good in "grunt" way compared to "browserify" package.json-based way is that one can has any number of completely independent configurations. |
I use browserify as client-js build tool, but I don't have "node_modules" directory for client code, so all dependencies use relative paths: P.S. Sorry for bad English. |
@SerjoPepper While that approach can definitely lead to cleaner requires statements, it goes against the browserify/node way of doing things, so I'm reluctant to add it as a capability to grunt-browserify. |
Has anyone else hit on |
Hey, @jmreidy. I just tested my application on |
@jmreidy, i'm using the |
version 2 is merged! |
Pulling in @bclinkinbeard, @hurrymaplelad, and @shama.
It's time to talk about v2. I've been keeping this on the back burner for awhile, but I think I finally have bandwidth to work on it.
What needs to get done:
module.exports
and unit test it or anything, but cleanliness will definitely help with maintainability.alias
andexternal
are handled. It's incredibly annoying to have to specify aliases for a common module, and specify the same aliases AGAIN asexternal
for another module. I'd like to declare common module aliases as an array, and then re-use that array to pass toexternal
of another g-b task. (If this doesn't make sense, I can put together a sample gist.)What else?
The text was updated successfully, but these errors were encountered: