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

[Question] Is there a way to include custom loaders? #1619

Open
lars-berger opened this issue May 2, 2020 · 4 comments
Open

[Question] Is there a way to include custom loaders? #1619

lars-berger opened this issue May 2, 2020 · 4 comments

Comments

@lars-berger
Copy link

Type of Issue

[ ] Bug Report
[ x ] Feature Request

Description

We recently separated out reusable components from our app into a library handled by ng-packagr and that has worked great so far. However, we have a whole bunch of data-access services that could be reused. The problem is these services rely on .graphql files.

To handle this in the angular apps, we extend the webpack configurations to include graphql-tag/loader. There's a small rollup plugin that does something similar. However, in the docs, the comment about custom rollup plugins is removed:

If required, users should be able to provide a custom rollup configuration to ng-packagr by settings the rollup.config JSON configuation property.

How do we go about handling this? Is this even possible?

@klemenoslaj
Copy link
Contributor

That would be absolutely amazing. I just came here to open the same issue.
We literally have the exact same problem. Having GraphQL documents in TS is the only thing that works, but that is of course extremely bad due to increased script initialization time and the impact it has on the bundle size.

@alan-agius4
Copy link
Member

While I do agree that ng-packagr needs to provide more ways to customize your build. IMO, doing so at a Rollup level is not the correct approach. This is because Rollup only processes 2 out of the 3 formats that a library is packaged in.

This however, involves a major re-design of the system to make it more pluggable.

@klemenoslaj
Copy link
Contributor

Thanks for being so responsive @alan-agius4 👍

ng-packagr being that closed is currently a major issue for our tech stack as it directly effects the performance of the application due to reasons mentioned above.

I don't see major re-design happening any time soon, but can we do anything to get this moving?

@klemenoslaj
Copy link
Contributor

@alan-agius4 Angular 12 was released recently and partial builds do provide some simplifications I guess. Do we have any chance of getting this in sometime?

GraphQL is still a pain point we cannot solve.
While we can extend wepback configuration with graphql-tag/loader, we'd require .graphql or .gql files which makes ng-packagr scream.

There are other options of preprocessing, such as babel plugin but that of course won't work either.

Do you maybe have any suggestion?

lekhmanrus pushed a commit to lekhmanrus/ng-packagr that referenced this issue Apr 14, 2022
Ability to modify source files before compilation.
E.g.: might be used to compile pug files to html.
Probably related to ng-packagr#1619.
NgPackage config can have resourceReader string - path to exported JS
function responsible for reading sources code files.

closes ng-packagr#1601
lekhmanrus added a commit to lekhmanrus/ng-packagr that referenced this issue Apr 14, 2022
Ability to modify source files before compilation.
E.g.: might be used to compile pug files to html.
Probably related to ng-packagr#1619.
NgPackage config can have resourceReader string - path to exported JS
function responsible for reading sources code files.

closes ng-packagr#1601
lekhmanrus added a commit to lekhmanrus/ng-packagr that referenced this issue Apr 15, 2022
Ability to modify source files before compilation.
E.g.: might be used to compile pug files to html.
Probably related to ng-packagr#1619.
NgPackage config can have resourceReader string - path to exported JS
function responsible for reading sources code files.

closes ng-packagr#1601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants