Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Does google cloud function supports tree shaking?

Will there be any difference in doing 1 or 2?

1

import includes = require("lodash/includes");

export const isVeggie = functions.https.onCall((a, b) => includes(["potato", "tomato"], "onion"));

2

import _ = require("lodash");

export const isVeggie = functions.https.onCall((a, b) => _.includes(["potato", "tomato"], "onion"));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It isn't the responsibility of Cloud Functions to support or implement tree shaking. It is just a runtime environment. It will dutifully run whatever you deploy to it. It's up to you to add any sort of compilation, transpilation, or tree-shaking to your code build if you want that to happen prior to execution.

From MSDN:

In modern JavaScript applications, we use module bundlers (e.g., webpack or Rollup) to automatically remove dead code when bundling multiple JavaScript files into single files. This is important for preparing code that is production ready, for example with clean structures and minimal file size.

So, if you are building to webpack or rollup properly configured for tree shaking, it will work fine and possibly minimize the amount of code that gets loaded at runtime.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!