-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Remove Blaze dependency from base packages #6844
Comments
Although it has a dependency on blaze, as long as it does not have a dependency on blaze-templates we on angular land should not get affected. |
It appears to be marked as a weak dependency https://github.com/meteor/meteor/blob/devel/packages/accounts-base/package.js I wonder if we should change meteor's behavior to not load weak dependencies by default. |
Weak dependencies are already not included by default, there is most likely another package at fault here. |
Unfortunately it's not easy to tell which one as of yet. Though personally my meteor-base mobile-experience mongo session jquery tracker es5-shim alanning:roles accounts-password netanelgilad:angular-server anti:fake random twbs:bootstrap fortawesome:fontawesome tmeasday:publish-counts standard-minifier-css standard-minifier-js modules angular-templates percolate:find-from-publication matb33:collection-hooks tmeasday:publish-with-relations pbastowski:angular-babel dburles:mongo-collection-instances |
Here are my packages: |
@Akryum Almost certainly |
What can I do to remove the blaze dependency then? |
I don't think you can. I created a new project and got rid of the blaze packages and I still have it. The meteor-base # Packages every Meteor app needs to have standard-minifier-css # CSS minifier run for production mode |
You're going to get it regardless because your app will need
|
Maybe we could get rid of these dependencies? |
boilerplate-generatorprovides https://github.com/meteor/meteor/blob/devel/packages/boilerplate-generator/boilerplate_web.browser.html which is a sparebars template that gives the main file of the application so we can't get rid of webapp->boilerplate->spacebars spacebarsprovides https://github.com/meteor/meteor/blob/devel/packages/spacebars/spacebars-runtime.js which requires blaze. However, from looking at it I wonder if we can have a non-reactive version of spacebars so we do not need to include the blaze reactivity on the boilerplate code. |
|
Why do these dependencies matter? These only load Blaze on the server, right? |
@stubailo I don't believe so. It seems that these packages automatically add a ton of client dependencies like JQuery (https://atmospherejs.com/meteor/blaze). Meteor needs to move in the direction of being more split up for people who want to use either React or Angular as a template tool. |
@reohjs not true- boilerplate-generator explicitly uses Blaze: |
@DerekTBrown You can certainly remove jquery from your client bundle, see #6563 and https://github.com/meteor/meteor/blob/devel/History.md#v132 You are correct that boilerplate-generator uses Blaze, but as @stubailo mentions, this is only on the server: api.use(['underscore', 'spacebars-compiler', I'm all for cleaning these dependencies up though. |
@skirunman the issue you are mentioning only removed JQuery from check (https://github.com/meteor/meteor/pull/6710/files) not as a dependency from Blaze: https://github.com/meteor/meteor/blob/devel/packages/blaze/package.js#L8 |
That's correct, but my understanding is that Blaze has a hard dependency today on jquery anyway. Might want to ask guys that know Blaze much better than I do like @mitar. Anyway, my understanding of your issue is that you want to make sure libraries you are not going to use on the client, like blaze and jquery, are not included in your client bundle if you are using React. Blaze and jquery can be excluded from the client today if you are using React, just as we are doing today. It looks like they will still be included in the server bundle, but it does look like it may be possible to remove them with some refactoring. If that is of issue for you you could try generating a PR. |
@skirunman @mitar - I don't care if Blaze / JQuery are included in my server bundle, but I don't want them included in the client bundle. The problem, is that the following dependency chain exists: meteor-base -> webapp -> boilerplate-generator -> spacebars -> blaze -> jquery Even if I want to use React or Angular, I still need webapp in order to serve HTTP content, which, in turn automatically imports clientside JQuery. |
Does webapp need jQuery on the client? Maybe we should just limit dependency on webapp for jQuery to server only? |
Unless I missing something here, it looks to me that jQuery is only being included on the server from the webapp -> boilerplate-generator dependency. https://github.com/meteor/meteor/blob/devel/packages/webapp/package.js
and boiler-plate only looks like it runs on the server. https://github.com/meteor/meteor/blob/devel/packages/boilerplate-generator/package.js
|
So where is the jQuery dependency defined? |
I think it's |
@mitar I do not see any client dependency for Blaze or jQuery in the meteor-base package so I think that is fine. If you include the static-html package in your app then there is a dependency chain of static-html > templating-tools > spacebars-compiler > blaze-tools, html-tools, htmljs Looking at the packages blaze-tools, html-tools and htmljs and the dependency chain I don't see any dependencies on jQuery or Blaze. There is a Package.onTest dependency in the spacebars-compiler package for both blaze and spacebars, but my assumption is these dependencies should not be included unless you run the Also, static-html is a build plugin and I thought build plugins were not built in to the client bundle (could be wrong). https://github.com/meteor/meteor/blob/devel/packages/static-html/package.js Hope this helps. |
Bottom line is that I didn't include jQuery in my Meteor app at all, and it's included on the client my production apps. NPM packages and build tools are installed as developer only because they're for development only. I think MDG is very clear on where jQuery is used and what depends on it. I think they're intentionally ignoring it because they feel like they have bigger fish to fry. Regardless, there's a big part of me that feels like this just shouldn't be a problem and Meteor should be architecting their development build tool like any other. I know for sure that webpack doesn't give me these problems. |
@ElegantSudo If you include Blaze you are going to get jquery as Blaze currently has a dependency on jquery. Are you using Blaze in your app or another package that has a dependency on Blaze or jquery? For instance, accounts-ui which is going to also pull in jquery through its dependency chain. |
@skirunman I'm a 100% React app with no accounts-ui, no Blaze, and no jQuery dependencies from my packages as far as I can tell. It would be great if there were a program that allowed you to track dependencies, but currently I'm at a loss. I'm going to go into my Meteor folder tonight and search the cached packages for dependencies with Atom. |
It is a bit frustrating that we can not remove blaze dependencies from the client side, even when we are using React or Angular. It seems to affect the loading time of app on startup. |
FYI, you can completely removed jquery dependency from client bundle. static-html module used to be a blocking issue, but the jquery dependency was removed in this commit a91a1cc. You still have a server dependency on jquery because of package boilerplate-generator and the dependency chain starting with webapp package. |
Hi all - it looks like we're now in a good position to close this issue, for the following reasons: Issue Summary
Breakdown
One quick thing to note - after removing the
ConclusionGiven the above, I'll close this issue. Thanks for opening this originally, and thanks everyone for participating in the discussion! |
For completeness, I opened this issue to remove |
One issue is that it's not easy to identify which code is being loaded on the client - so it's hard to verify that Blaze is only being loaded on the server. |
Great point @skirunman, thanks for doing that! Also a great point @stubailo - I think that would be best tracked in a new issue / feature request (if anyone wants to open / champion one). |
Presumably, #8073 will identify which packages were are bundled, when it's done. |
@hwillson I removed Blaze but I could not remove Jquery. Just commented the line <script type="text/javascript" src="/packages/jquery.js?hash=c57b3cfa0ca9c66400d4456b6f6f1e486ee10aad"></script> Besides standard packages, I use this:
Also noticed in your comment, Breakdown 2, you say:
Should be remove jquery? I also removed jquery.js manually, but the building process generated it again. What could be wrong? Thanks |
@jmaguirrei - Regarding breakdown 2, I mentioned removing the |
@hwillson OK! I just commented on that package. Thanks. |
These are my packages
but I still have blaze.
I tried figuring out the package which causes this indirect dependency, but was unable to? Can someone help? |
@s7dhansh Try removing each package one by one from the |
@abernix I had done that already, to no avail. That is why I posted here to get some help :). I just debugged on a bare app, and realised a few things that were already written above in this issue. Silly me, for not reading it properly earlier. The |
I appears that some base meteor packages still have a blaze dependency even if we don't want to use it. And because of that, we can't completly remove jquery.
Investigations shows the following dependencies for now:
Original post
(Using Meteor 1.3.2.1)
It should be possible to use the package in a non-blaze project (for example with angular, react or vue), without the blaze dependency (and jquery). In my current project, I am only using static-html with vuejs, plus some custom login service plugged into Meteor account system, and the app still has to load blaze and jquery.
It would be great if accounts-base was ui agnostic for use in any kind of project.
The text was updated successfully, but these errors were encountered: