Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda