0

I am trying to add a JS script bundle file to a custom Angular Library which is using features from it. I have added the types files so the linting errors are not showing, but the Project does not get built as classes from JS Bundle are not found.

I have tried and failed importing the bundle to the public-api file.

I am thinking of trying to make the bundle a private npm package to install. But that will take lot of time and effort. What other options do I have?

1 Answer 1

1

Sometimes you could have that kind of circumtances like having would like to use an JS library in your Angular project.

i have encountered something like that but i have created one directive file in the src folder like "type.d.ts" so after i declared my library in it with something like "declare module 'pdfmake/build/vfs_fonts.js';" and at last imported it in my component file like "import * as pdfMake from 'pdfmake/build/pdfmake.js';"

1- Create one directive file like "type.d.ts"

2- Declare your JS library in your recent file created with something like "declare module 'pdfmake/build/pdfmake.js';"

3- Declare back the import statement in your component file like "import * as pdfMake from 'pdfmake/build/pdfmake.js';"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.