Where is Blaze and jQuery coming from?

In checking my production app, I noticed that the $ function exists in the econsole, and there are references to Blaze in various places in the JS bundle.

How can I check for these, and make sure they are not being included in my project? Is there some kind of tool that can graph out the dependency tree?

I did find this, but I’m not sure how to use it https://gist.github.com/deanius/d3f18b07454cd8416417

Adding these kinds of tools to Meteor as first class citizens (especially with the dynamic module feature) would add a lot of value to the Meteor platform

There is no way to view the dependency tree so far as I know. The best you can do is meteor list. I’ve got a JQuery dependency that won’t go away no matter what I do. If you post your list of Meteor packages here, I’m sure Blaze would be easy enough to root out.

You could try this:

for p in meteor list | grep '^[a-z]' | awk '{sub(/[+*]$/, "", $2); print $1"@"$2 }'; do echo “$p”; meteor show “$p” | grep -E ‘^ [a-z]’; echo; done

from https://github.com/meteor/meteor/issues/2853#issuecomment-283320603

Here are my packages

accounts-base@1.3.0
accounts-password@1.3.6
audit-argument-checks@1.0.7
browser-policy@1.1.0
check@1.2.5
dynamic-import@0.1.0-rc.7
ecmascript@0.8.0-rc.7
email@1.2.1
force-ssl@1.0.14
fastclick@1.0.13
meteor-base@1.1.0-rc.7
mobile-status-bar@1.0.14
mongo@1.1.18-rc.7
react-meteor-data
shell-server@0.2.3
standard-minifier-js@2.1.0-rc.7
static-html@1.1.12_1
tracker@1.1.3

alanning:roles
aldeed:collection2-core@2.0.0
aldeed:schema-deny
aldeed:schema-index
edgee:slingshot
ground:db
fourseven:scss
kadira:flow-router
seba:minifiers-autoprefixer

When I look in versions I see jquery and blaze listed:

accounts-base@1.3.0
accounts-password@1.3.6
alanning:roles@1.2.16
aldeed:collection2-core@2.0.1
aldeed:schema-deny@2.0.0
aldeed:schema-index@2.0.0
allow-deny@1.0.5
audit-argument-checks@1.0.7
autoupdate@1.3.12
babel-compiler@6.19.1-rc.7
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
blaze@2.3.2
blaze-tools@1.0.10
boilerplate-generator@1.1.0-rc.7
browser-policy@1.1.0
browser-policy-common@1.0.11
browser-policy-content@1.1.0
browser-policy-framing@1.1.0
caching-compiler@1.1.9
caching-html-compiler@1.1.2
callback-hook@1.0.10
check@1.2.5
ddp@1.2.5
ddp-client@1.3.4
ddp-common@1.2.8
ddp-rate-limiter@1.0.7
ddp-server@1.3.14
deps@1.0.12
diff-sequence@1.0.7
dynamic-import@0.1.0-rc.7
ecmascript@0.8.0-rc.7
ecmascript-runtime@0.4.1-rc.7
ecmascript-runtime-client@0.4.1-rc.7
ecmascript-runtime-server@0.4.1-rc.7
edgee:slingshot@0.7.1
ejson@1.0.13
email@1.2.1
fastclick@1.0.13
force-ssl@1.0.14
force-ssl-common@1.0.14
fourseven:scss@4.5.0
geojson-utils@1.0.10
ground:db@2.0.0-rc.7
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.2.12
id-map@1.0.9
jquery@1.11.10
kadira:flow-router@2.12.1
livedata@1.0.18
localstorage@1.1.0-rc.7
logging@1.1.17
meteor@1.6.1
meteor-base@1.1.0-rc.7
minifier-css@1.2.16
minifier-js@2.0.0
minimongo@1.2.0-rc.7
mobile-status-bar@1.0.14
modules@0.9.0-rc.7
modules-runtime@0.8.0-rc.7
mongo@1.1.18-rc.7
mongo-id@1.0.6
npm-bcrypt@0.9.2
npm-mongo@2.2.24
observe-sequence@1.0.16
ordered-dict@1.0.9
promise@0.8.8
raix:eventemitter@0.1.3
raix:eventstate@0.0.4
random@1.0.10
rate-limit@1.0.8
react-meteor-data@0.2.11
reactive-dict@1.1.9-rc.7
reactive-var@1.0.11
reload@1.1.11
retry@1.0.9
routepolicy@1.0.12
seba:minifiers-autoprefixer@1.0.1
service-configuration@1.0.11
sha@1.0.9
shell-server@0.2.3
spacebars@1.0.15
spacebars-compiler@1.1.2
srp@1.0.10
standard-minifier-js@2.1.0-rc.7
static-html@1.2.2
templating-tools@1.1.2
tmeasday:check-npm-versions@0.3.1
tracker@1.1.3
ui@1.0.13
underscore@1.0.10
url@1.1.0
webapp@1.3.16-rc.7
webapp-hashing@1.0.9

I removed every package except meteor-base@1.1.0-rc.7 and jquery remained. Then I remove that, and versions ended up empty. Then I put it back, and jquery came back.

Then I added back everything, and removed meteor-base, and jquery remained.

Then I created a new app from scratch - it has jquery in it…

Some core Meteor packages still require jQuery and that’s why it’s in the builds. They are looking at ways to fully remove it as a requirement, but they aren’t there yet.

It must be required by meteor-base

I know I heard @sashko talking about this process in a YouTube video, I just don’t remember what one, but likely yes meteor-base or something it requires.

Hmm, it must only be required on the server though, I don’t have it on my client.

If you are using (or when you will use) meteor-1.,5 then the package bundle-visualizer is super useful to graph packages in use, their sizes (and the whole size of the program in production) and their dependencies.

It helped us to reduce about a 20% the bundle size, removing, replacing and optimizing some packages.

2 Likes

Btw, I wonder if Google’s Closure Compiler could be used to further reduce bundle size. Maybe it could be as simple as taking the compiled .js file from Meteor and run it through it? Seems like it’s smarter than a plain minifier.

I have it in my console as $ - I’m not entirely certain some Chrome extension isn’t adding it though.

I installed that - but in a brief look honestly wasn’t sure what it all meant. I’ll have to find some readme or guide somewhere. It’d be nice if we could get a version of bundle-visualizer that didn’t show all the server modules.

This package is not intended for server modules, all the references are client side.

You have to run your app with --production flag and visit http://localhost:3000/_analysis

More info about github 1.5 release: https://github.com/meteor/meteor/pull/8327

Seems that Meteor 1.5 will be launched very soon.