Angular-cli: TypeError: favico_js_1.default is not a function - 3rd party library error

Created on 8 Jan 2018  路  2Comments  路  Source: angular/angular-cli

Versions

Angular CLI: 1.6.3
Node: 8.7.0
OS: darwin x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cdk: 5.0.3
@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.7.0-dev.20180107
webpack: 3.10.0

Repro steps

I have some 3rd party library, such as favico.js and socket.io, I tried two ways of this link: https://github.com/angular/angular-cli/wiki/stories-third-party-lib

  1. First way , with install @types/favico.js , I still get this error:
ERROR TypeError: favico_js_1.default is not a function
  1. Second ,way
    I get this when ng serve
error TS2306: File '/***/node_modules/@types/favico.js/index.d.ts' is not a module.

Mention any other details that might be useful (optional)

Most helpful comment

You can import 3rd party library like this : import * as from 'favico.js'; use * Instead of use packgeName direct

All 2 comments

You can import 3rd party library like this : import * as from 'favico.js'; use * Instead of use packgeName direct

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings