Skip to content
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

Use minified Cesium in Node.js unless NODE_ENV=development #7514

Merged
merged 2 commits into from
Jan 31, 2019
Merged

Conversation

mramato
Copy link
Contributor

@mramato mramato commented Jan 24, 2019

We know that removing debug code in Cesium can provide a substantial speed improvement, but previously the Node.js version would always use separate modules. This change allows Node.js to load the combined/minified version by default, for improved performance, and only loads the old
separate modules if NODE_ENV=development (which is the standard mechanism for enabling extra debugging checks in most node packages.

@shunter I was fumbling around with getting the minified version to load at all in node, my changes in Source/main.js were needed to get it to happen. As far as I can tell, this has no impact on browser-based usage; but can you take a look and let me know if there's a better approach here.

Partially stems from discussion in #7508, but this is something we've tried in the past and I finally bit the bullet to figure it out.

CC @shehzan10

We know that removing debug code in Cesium can provide a substantial
speed improvement, but previously the Node.js version would always use
separate modules.  This change allows Node.js to load the combined/minified
version by default, for improved performance, and only loads the old
separate modules if NODE_ENV=development (which is the standard mechanism
for enabling extra debugging checks in most node packages.
@cesium-concierge
Copy link

Thanks for the pull request @mramato!

  • ✔️ Signed CLA found.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@mramato
Copy link
Contributor Author

mramato commented Jan 28, 2019

@shunter any comments here? If now, should be ready to merge.

@mramato
Copy link
Contributor Author

mramato commented Jan 29, 2019

Is anyone else comfortable reviewing this?

CC @ggetz @hpinkos

@mramato
Copy link
Contributor Author

mramato commented Jan 31, 2019

image

@hpinkos
Copy link
Contributor

hpinkos commented Jan 31, 2019

Looks fine to me. Thanks @mramato

@hpinkos hpinkos merged commit a03edeb into master Jan 31, 2019
@hpinkos hpinkos deleted the node-env branch January 31, 2019 14:58
@mramato mramato mentioned this pull request Feb 5, 2019
mramato added a commit that referenced this pull request Feb 12, 2019
While the improvements in #7514 worked, they were a little more convoluted
than they had to be and also caused some weird edge cases where loading
Cesium in eval'd Node.js code didn't work.

This change avoids using requirejs entirely when loading minified Cesium
in Node and adds a smokescreen test to travis that fails in master. This
also avoids the odd global workaround I had to put in place previously.

I did have to modify the UMD headers for NoSleep.js and purify.js because
their preference is to look for Node.js first and not use AMD if it's
found, this was the root cause of the failures we were seeing in eval'd
code.  The smokescreen test I added will fail again if the problem were
reintroduced.

So overall, this make Cesium a little more node-friendly and just makes
things cleaner from our end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants