Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I add a raw JavaScript file to be processed by ng-packagr #650

Closed
MahiK14 opened this issue Feb 27, 2018 · 9 comments
Closed

How do I add a raw JavaScript file to be processed by ng-packagr #650

MahiK14 opened this issue Feb 27, 2018 · 9 comments
Labels

Comments

@MahiK14
Copy link

MahiK14 commented Feb 27, 2018

Hello ,

I am facing the following error:BUILD ERROR
Could not resolve '../../code-editor/code-editor/wetty.js' from .ng_pkg_build/code-editor-module/ts/code-editor/code-editor/code-editor.component.js
Error: Could not resolve '../../code-editor/code-editor/wetty.js' from .ng_pkg_build/code-editor-module/ts/code-editor/code-editor/code-editor.component.js
at error (/Users/mahender/git/code-editormodule/code-editor-module/node_modules/rollup/dist/rollup.js:185:14)
at then.resolve

Wetty.js is simple js file.
How can I include external js files in the ng-packagr process?

@alan-agius4
Copy link
Member

That is not possible by TypeScript at the moment.

#540

@scott-ho
Copy link

@alan-agius4 it's incorrect that TypeScript doesn't support it. It just doesn't support allowJs and declaration at the same time.

However, after I managed to disable the declaration generation in ng-packagr(it's hardcoded), I still can't find the raw js module in output dir and errors prompt.

I think this might a ng-packagr issue to output the raw js module in the bundle.

/cc @dherges

@alan-agius4
Copy link
Member

As explained in the issue linked that’s why it’s not supported, ie: allowJS with declarations.

When generating a valid library you always need to generate declarations.

@alan-agius4
Copy link
Member

alan-agius4 commented Nov 28, 2019

Blocked on Angular supporting TS 3.7, which addresses microsoft/TypeScript#7546

@eric-simonton-sama
Copy link

Am I interpreting correctly that the TS blocker is resolved now (from this)? And if so, is allowJs being considered for ng-packagr now?

@ocombe
Copy link
Contributor

ocombe commented May 10, 2021

@eric-simonton-sama
Copy link

@alan-agius4 What prompted closing this PR? Should I be excited that it's going to work now? Disappointed that it never will? :)

@alan-agius4
Copy link
Member

This should now work if you use Typescripts allowjs option.

@github-actions
Copy link

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

This action has been performed automatically by a bot.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

5 participants