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

257
Vistas
Terser keep (don't mangle) a specific function name

Is there a way to not mangle only one function name? A comment in the code would be easiest, but I guess this could be done by specifying a custom "nameCache" ? But I don't know how that works.

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I couldn't figure this out, but I already had the function name so I stored the function name on the webpage in an attribute that I could find later with JavaScript. e.g.

function bob() {
  console.log('hello');
}

document.querySelector('#myid').setAttribute('data-function-name', bob.name);
<span id="myid">for example make this style="display:none;"</span>

about 4 years ago · Santiago Trujillo Denunciar

0

To prevent terser from mangling a particular symbol, you need to add it to terser's reserved list. This can be done in your terser options file:

{
    "mangle":
    { 
        "properties":
        {
            "reserved": ["symbolToNotMangle", "anotherSymbolToPreserve"]
        }
    }
}

If you are not already using a terser options file, you would save that off to (for example) terser_options.json and tell terser to use it like so:

terser ... --config-file terser_options.json

You can also just list the reserved symbols on the command line if you prefer:

terser ... -m reserved=['symbolToNotMangle','anotherSymbolToPreserve']

https://github.com/terser/terser#cli-mangle-options

about 4 years ago · Santiago Trujillo 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