Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda