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

217
Vistas
Could not resolve js when building Angular library

The general task is to wrap up some third party UMD libraries in an Angular library and enhance them with strong typing.

I want to save the user of the library from having to manually add the UMD libraries in his project and include them by <script> tag for example.

Consider the following example project:

project structure

tsconfig.lib.json:

  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/lib",
    "allowJs": true,
    "declaration": true,
    "declarationMap": true,
    "inlineSources": true,
    "types": []
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

test-lib.service.ts:

import { Injectable } from '@angular/core';
import * as extLib from './external/externalLib';

@Injectable({
  providedIn: 'root'
})
export class TestLibService {
  private n: string = '';

  constructor() { }

  getStringFromNumber(n: number) {
    this.n = extLib.getString(n);
  }
}

When executing ng build I get the following error: error

What am I missing?

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