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

310
Vistas
Yarn nohoist without using workspaces

One of my projects suddenly failed to compile on a Windows laptop, where the exact same code was working on a Mac. I've read about hoisting and adding nohoist, which seemed to fix the problem for Apollo client.

"workspaces": {
    "packages": [
      "packages/*"
    ],
    "nohoist": [
      "**/tslib",
      "**/tslib/**"
    ]
}

Now, I don't use workspaces, but since I am using the code above in package.json, Yarn asks for the -W parameter when adding or removing packages saying:

error Running this command will add the dependency to the workspace root rather than
the workspace itself, which might not be what you want - if you really meant it, make it
explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

It doesn't seem to me like this is the best way to go. What should I do?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

By adding the workspaces config in your package.json you have enabled the use of workspaces. This is why you're getting the warning about adding the dependency to the workspace root. nohoist is a workspace only option; it was created to enable 3rd party libraries that are not compatible with the yarn workspace hoisting scheme to still be used under workspaces. See https://classic.yarnpkg.com/blog/2018/02/15/nohoist/

“nohoist” enables workspaces to consume 3rd-party libraries not yet compatible with its hoisting scheme. The idea is to disable the selected modules from being hoisted to the project root. They were placed in the actual (child) project instead, just like in a standalone, non-workspaces, project.

If you don't want to use workspaces, you need to remove the workspace configuration from your package.json and fix your compilation issue another way.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Actually, it is the proper way to exclude some packages which it is needed to have different versions of them in your workspaces packages by using the below config:

"workspaces": {
  "nohoist": [
    "**/[package-name]",
    "**/[package-name]/**"
  ]
}

This will help to have successful build.

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