@benjamn what are the alternatives to require.ensure and module.hot in a fully ES2015 world of import and export that will allow the same features for which we love webpack for our build system.
If ES2015 or other tech is not providing an alternative, then we still need webpack and commonjs require.ensure and module.hot to do its thing.
When the ES2015 world of import and export provide such capability then an alternative to webpack exists and its 3rd party loaders will need migration too.
Until that design problem has a solution, then Iāll still appreciate that we can use commonjs and webpack (also for its other speed and advanced configuration features) with meteor with webpack:webpack (@eXon is working on 1.3 integration in the next branch).
So eventually weāll need migration from the meteor+webpack or non-meteor+webpack solution to that shiny ES2015 solution when available with or without meteor.
btw, thanks for the great job, it seems to be heading in a better direction.
I feel Meteor 1.3ās new modules system is going to make Meteorās build system better than Webpack or Browserify (although it might possibly be limited to Meteorās ecosystem, @benjamn ?).
Is what too hard? @benjamn is already making it happen, so not for him. And, yes, Webpack is flawed, as you just quoted.
We must take first steps first. Meteor 1.3ās modules system is the first step towards other features that could be similar to or better than Webpackās. In practice, we already have code splitting in Meteor 1.3 by simply writing more than one entry point. I would doubt that @benjamn hasnāt thought of how to share common modules between packages (code splitting). The steps that Meteor 1.3 is taking are making Meteor better. If you have advice on what exactly MDG should do to make Meteor better, please do share.
Youāre not noticing the great progress that Meteor 1.2 (and now 1.3) are bringing to the table.
Soon enough Meteorās build system will be arguably better than Webpackās, etc.
Thatās all talk and no do. If you have ideas on what should actually be done, then share them, otherwise people who are actually doing will make things happen the way they see fits best into Meteor.
Blaze 2 is in the works. Plus I like React much better than Blaze 1 anyways. Tracker is really handy, even while I use React, so I donāt see why thatās going anywhere. Publications are super useful too, I donāt see why those are going anywhere, even with GraphQL in the mix (the client should be able to run GraphQL queries only on published data). We can live without Atmosphere if all packages are NPM-compatible, honestly, and who cares as long as you can get the libraries that you need into your project? Atmosphere will still be there for packages on Atmosphere that havenāt been updated to live on NPM. Atmosphere dying isnāt a huge deal. What is a huge deal is that the new NPM support in 1.3 opens Meteor up to a huge community of developers that were previously outside of Meteor due to packaging restrictions in versions of Meteor up to 1.1.
Over Blaze 1, it is to me. I like to write well structured and modular code, and React does that better out of the box than Blaze 1. Just because Blaze is homegrown doesnāt mean itās automatically better. Some ideas (like Spacebars templating) might be better in the opinion of some, which is fine, and which is the reason why Blaze 2 is in the works to provide the familiar language, but powered by React. Personally, Iām fine with JSX because I like the control I have with JavaScript compared to any more-limited templating language.
Itās also clear that these votes are made comparing existing technologies (Webpack, Browserify, JSPM, etc). But they didnāt take into consideration Meteorās new modules system. Before the iPhone came out, no one had any idea what a āsmart phoneā could be like. This is the same: you have no idea how awesome 1.3 modules are because you probably havenāt seen all the aspects of it yet (Iāve written a build plugin for Meteor before, so I might have more perspective on this in order to see the benefits of the new system).
And itās embraced by the community because of how great itās concepts are. React is an amazing new way of thinking of UI composition and structural rendering (how we morph the UI structure of an app with a diffing algorithm), and has inspired projects like Mithril, Mercury, Om, etc.
It (the self-serving of React into Meteor) definitely makes my development experience in Meteor better, and it also makes my development experience with others better because itās easier to reason about the UI in huge projects when code is modular and not globally scoped, thanks to React (compared to Blaze).
Can describe what you want to achieve by ācode splittingā exactly? You want to load separate entry points at certain times (f.e. the view changes)? I have an idea for thisā¦
Iād like to be able to limit what templates/JS the client gets and when, with something like associative tags I suppose.
For example, when a user first loads the application, thereās no need for them to get all the templates and JS. If theyāre on a wizard, load up the first few pages of the wizard, and as they progress download more to the client as needed.
Another example would be, if a user doesnāt get a feature because theyāve not purchased it, they should never get this code unless/until theyāve gone through a purchase process. Then they can get the feature pushed down to the client.
Right now, my application is large. I have well over 100 Blaze screens and that number is growing all the time. The client today gets everything, every template and client JS file, even if they never use it. The site also has a built in Admin side, with many templates and code, but only a fraction of the users will ever need it.
I donāt think React is the right tool (yet). Tracker is the main reason for that. Shadow DOM and JSX aside, I think Blaze is the better choice until Tracker getās the integration it deserves in React.
Nah it aināt dying. Hipsters gonna hip is all. MDG needs to keep their eyes on the prize and make the best tool for Meteor devs. There is nothing like Meteor out there, period.
Yep, I agree, we need to be able to load files on demand, as in the idea I mentioned. Iād love for Meteor to have this feature now that it has modules! They go nicely together! We can write individual entry points to load separately.
But webpack seems to already work with the right package (and a modified project structure). Iāve seen it work in the ākickstartā demo projects, using webpack:webpack package. Sure it would be nice it was a little better integrated with Meteorā¦
I think code splitting is really important. One example: Iām building an app with react, but Iām using OrionJS for the admin panel. I donāt need all the bunch of Orion dependencies in the rest of my app, only for the /admin section.
But meteor doesnāt think about anything like that. Maybe Iām using a hefty charting library on just one page, why should I load that library when Iām using the rest of the site?
This is really important for mobile experience, when downloading all these extra libraries can take a long time over a slow network, also phones are slower in general.
I was thinking about splitting my app into two or more meteor apps, but that seems like a stupid solution, when the simple solution would be to just have code splitting, right?
I donāt foresee managing code-splitting (or on-demand loading) of a Meteor packageās files as a feature of Meteor in the near future unless packages use the new ES2015 modules and require us to import their libraries. If the orionjs packages let us explicitly import files from the package, then weāll be more ready to support this case in the near future. Weāll need some cooperation from the orionjs authors at some point (to convert their libraries to the ES2015 modules). As for the actual code splitting / on-demand loading, I might try to implement that myself if I have some time. It should be a matter of modifying Meteor to to read a config in package.json that tells it to ignore certain files, and to make Meteor serve those files via HTTP so they can be fetched on the client-side.
Yep, exactly! I agree 100%. Meteor 1.3 is a stepping stone towards us being able to load things on-demand the proper way (following standards). Weāll get there soon.
Of course, code-splitting / on-demand loading would be the ideal solution, but itās actually easy to do what you just suggested: we can make two Meteor apps share the same database. The second instance would just read the DB from the first instance. Then, each Meteor instance can send different things to the UI (and also some of the same shared code as well).
But yeah, Iād much rather have legitimate control over what scripts are sent to the client than launching two separate Meteor servers. Plus, with two servers on two different ports, itāll be slightly harder to make a sing-page app. itās a matter of manually connecting to the desired server from within the client code for specific views of the app (for example, an /admin view might need to establish a DDP connection to the second server manually which we gotta write extra code for unlike with the default first server).
Another thing you can currently do (which isnāt hard at all) is just compile your entry points manually with Webpack (or Browserify, JSPM, etc), place them in your public folder, then you can load those on demand right now! The only downside to this is that the build step for this lies in your hands, not in Meteorās. Youād have to make sure the files your app needs are in public before you run meteor deploy ... or the files will be missing in the deployment. This is probably the easiest route to take currently. You can have multiple entry points in your public folder, and load any of them whenever, but the downside is that anything in public is public, so a mailicious user could download the admin script even if the user is not an admin if the user knows the URL.
Meteor is just Node.js. Another thing you could do is compile entry points into somewhere besides public (a .hidden folder so they donāt get automatically loaded) then, write (or use from NPM) a simple HTTP server to serve those files with whatever security you may have in mind. The Meteor app could spawn the HTTP server on a separate port, but itād be on the same domain, so you can just request the files using the chosen port.
This kind of functionality is available for more than a year with preloader package - you can load different libraries per each route. Though it uses IronRouter but you can load libraries from wherever you want (CDN,ā¦).
Thanks for the info on these different approaches @trusktr
I wonder if this is the approach that kickstart-hugeapp project is doing? I havenāt dug into how it bundles the app, where they end up.
Public folder isnāt a problem from my point of view, better to rely on proper security rather than security by obscurity (although obscurity I guess is a good second line of defense!))
In any case I wish there was a little more information, either from MDG or somewhere else on how to do this. You say ājust compile your entry points manually with Webpackā but thatās not something I would know how to do on my own!
A component scoped within a class at that! Itās awesome.
1.2 also brought a major change to the build system, which compliments the ES2015 module system in 1.3. Meteor is itās own Webpack now, where āloadersā (or ātransformsā) can be added and removed as Meteor packages.
Thank you for your packages but some of them have major problems (i.e. CollectionFS). I understand that you may be busy but may I ask you why donāt you get some help and accept some maintainers for you packages?
I have spent literally days in selecting some of the libraries I needed and I still ended up with buggy libraries and the authors were unresponsive. I am not sure there is a straightforward solution to quickly identify āblessedā packages. NPM has similar problems.
I would love a place where:
I can see major companies that uses a packages.
Easy to surface critical outstanding bugs and quickly to close PR. I have to jump in Github and dig in issues. If the author does not keep the Issues on Github updated it is chaos. Some packages have tons of āissuesā and you never know which one is a real issue, which ones are issues with older versions that have been closed and which ones are just problems with the code of a newbie. If the author is not around to close issues and do a good admin job on the Github repo, I would love to see some well know people as maintainers.
I finally think that the solution has sort of human curation.