-
Notifications
You must be signed in to change notification settings - Fork 3
Update to webpack 0.9.x #144
Comments
👍 |
I have too little time for 0.9 currently, so it will take a month until beta at minimum. You should base on 0.8, which is prettly solid and the breaking changes for 0.8 are mostly option names and internal refactoring. Here is a changelog with changes from 0.6 to 0.8. I think you only have to change some of the passed options and some calls to loaders. I. e. Additionally to the migration I would refactor the following (optional):
Maybe some more loaders are interesting for you, i.e. jshint... |
I agree on your suggestions for refactoring. We're planing to provide all nice features of webpack (such as |
I'm looking forward to webpack 0.10, which has Hot Code Replacement.... Really want it 😃 |
- separated val-function and renderer to make thing clearer - passing rootPath to template to resolve the right file - related to #144
- some path-handling fun... - tidy tidy - bundle with val-loader is working now - #144
My local build works, but the remote version fails... awesome! 🐒 |
Fixed! The next step will be the dev-middleware. |
I implemented the webpack-middleware to handle static request in dev-mode. I seems like the webpack-middleware is always serving cached files if already compiled and only recompiles in watch-mode. Watch seems like a good solution but as we experienced with nof5 it has troubles to watch many files and fails on some os'es. I wasn't able to test the watch mode, because it had to watch to many files and osx restricts the watchers to a relatively low number. Of course there are workarounds by setting a different number on os-level but i would prefer to have a second option for cache invalidation. Maybe webpack could rebundle on every request but load existing files that didn't change from cache instead of starting the whole rebundling process. Would there be a performance improvement or does the analyzing part take the most time? What do you think @sokra? PS: its not pushed yet, because i wanted to find a suitable solution before publishing to master. |
I didn't know about this osx problem. On windows and linux I never had issues watching many files. We could change the middleware so that But this would fix the watch mode on OSX... (Sadly, watch mode is so cool) We could reduce the number of watched files by merging them by directory. But this would result in false positives... |
I didn't know about this problem with OSX. I never had problems on windows and linux. We could change the behavior for the middleware on But what's the long term solution for watch mode on OSX? We could reduce the number of watched files by merging them by directory (false positives). How low is the limit? |
ahrrg... github had update problems... and I retyped it.... :( |
You can try the new version of the middleware, which support watch = false. |
Thanks @sokra! I tried the new version of the dev-middleware and it's simply awesome. Compared to our latest - rebundle the whole thing every reload approach - it is very very fast. I will cleanup the whole thing and commit&merge tomorrow.
I will check on this one and find out about the limits. You suggest merging all files of a folder to reduce the number of files watched? Did i get that one right? |
Nice... With watch mode it would be even faster, because it would start compiling after files save.... Yes you get it right. Maybe this could be a separate module |
Compiling on request requires less performance but delays serving the bundle. And as a developer I would rather let my PC work harder than me wait longer 😀 @sokra How do you watch files? I'm using isaacs supervisor when I need to watch for file changes. But I haven't tried it with OSX either. |
@jhnns: The re-bundling is really quite fast, even if not using watch. We could make it configurable to use ether watch or rebundling on every request. This should be part of the yet to implement |
Ok dudes! Seems like watch is working and it failed because of some other weird circumstances during testing yesterday. 👍 At least with the todo-mvc-example it works nicely. It might break if the files being watched will be too many. Maybe we could add some kind of limit for the watch function, to fall back to re-bundling in case the limit is exceeded? |
Links related to the limit:
My limit on osx is set to 256 as a default value. Dunno about linux/windows. |
- made bundle.js the main module for the alamid-bundle process - using watch mode for webpack-dev-middleware - passing the config to the bundle-functions in order to decouple - using the latest development version of webpack-dev-middleware
I made alamid create a bundle in production mode, if there is no app.js in bundle folder. This way you could ether create your own bundle and ship it with your project, create it in init.server.js before starting the actual server or let it be created for you by alamid if you don't need any custom options. |
There is one problem left with the whole bundle-thingy. I replaced most tmp-files with the This is kind of pain in the ass, because you can't simply bundle, but have to render/copy the bootstrap before bundling and delete it afterward. The bootstrap has to be re-generated if a new file was added to the project manually (View, Model, Schema, Service). We would need separate watchers for those folder in order to regenerate the bootstrap, which would cause the bundle to regenerate as well. One options would be to get rid of the registries, which would mean more explicit definition by the developers but less hazzle for the bundling process. But we wanted to talk about this whole registry thing anyway. For now i would document it as a limitation:
@sokra webpack doesn't cache val-loaders, right? So are the registries (solved via val-loaders) always reloaded if an existing file was changed? I.e. if change a template .html and the rebundling causes the val-loaders to rebundle? We have to think of a way to generate and delete the bootstrap.js before/after the bundler starts. How about events like |
See pull request for solution. The val-loader can be made cacheable by the cacheable query parameter. ( But you can use real loaders, so you don't have to use the val-loader. The Loaders can access the webpackOptions, so you can pass any custom parameters, like the alamid config. A loader can flag itself as cacheable, by |
Very nice! Thanks for your work. I will take a closer look at it and merge it 👍 |
I checked it locally and a single test, which was to check the content of the rendered bootstrap is failing due to the changed bootstrap content. I will fix this one on my machine and merge. It's really awesome to get rid of the bootstrap.tmp generation 👯. |
- thanks again for your awesome webpack-module and your helping hand :) - #144
That's why I want to get rid of those registries. They're making bundling more complex and bring caching issues. Every registry that can be replaced by an explicit require is better (although the developer has to write more). |
@sokra are you going to publish the latest version of the webpack-dev-middleware? |
Oh sorry, it's now published... |
Thanks ;) |
webpack 0.9 will watch only 100 items. The total number is merged by directories ;) This is the crazy hacked code doing this: lib/node/NodeWatchFileSystem (somewhere is a bug... 😄 need to revisit it before release) |
Crazy 🐴. But you still have to take care of those files, and re-merge to a file? How do you do it ? Manually via timeouts? |
an example if the limit would be 4 and we want to watch these files:
it would be merged to this:
and only
is watched. on a change on it would read the timestamps for
to figure out what changed... |
Ah! You're watching dirs instead of files? |
yes, is this a problem? |
Nope! I was just wondering. I thought you were merging separate files in a single file to reduce watched files. |
I'm really looking forward to! Don't want to affront you but the code looks like callback hell 😄 |
@jhnns I know... :( That why I said "crazy hacked code". I will definitly revisit that file 😄 |
It doesn't work :( The gamebreaker is that fs.watch do not watch subdirectories... I have to get a new algorithm |
Ah nice. If there are any problems again, you could also try mikeal/watch. It's working quite well for nof5. |
Thanks for the offer, but webpack has some specific requirements to the watching process which couldn't be fullfilled by the libraries I investigated in.
mikeal/watch
|
Ok. But mikeal/watch works on windows 😄 |
ok it works... but really slow... |
We should update to the current version of webpack before release v1.
Maybe @sokra could help us to improve the whole bundle thing?
The text was updated successfully, but these errors were encountered: