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

177
Vistas
Consuming a JS library in Bazel

I have a front-end set up within a larger Bazel mono repo similar to this

Root
  |---UI
  |     |-React-App
  |     |-Component-Library
  |-package.json

The react app is set up using create-react-app. Npm is being managed by Bazel as defined in the repo WORKSPACE file I would like to create a js_library from the component-library folder and consume it in my react app. I created a sample library as such which builds successfuly.

ts_project(
    name = "compile_ts",
    srcs = glob(["src/*.ts"]),
)
js_library(
    name = "UIcomponent",
    package_name = "@npm-package-name/UIcomponent", 
    srcs = glob(["src/*.ts"]),
    visibility = ["//visibility:public"],
    deps = [":compile_ts"],
)

My question is how can I consume it inside my React-App. Currently, I am passing the library as such

_RUNTIME_DEPS = [
    "chdir.js",
    "copy_static_files",
    "@npm//react",
    "@npm//react-dom",
    "//UI/Component-Library:UIcomponent",
]
react_scripts(
    name = "buildBoilerplate",
    args = [
        "--node_options=--require=./$(execpath chdir.js)",
        "build",
    ],
    data = _RUNTIME_DEPS + [
        "@npm//@types",
    ],
    env = {
        "BUILD_PATH": "./buildBoilerplate",
    },
    output_dir = True,
)

I am consuming it in my app as such

import testFunc from "@npm-package-name/UIcomponent";

My app can't resolve this. I am assuming that I am making a mistake in the way I am consuming the library. Perhaps I need to pass it as a dependency instead of data. I'm really stuck here. Any help is appriciated.

about 4 years ago · Juan Pablo Isaza
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