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

Add writeFile and customTransformers to build and buildReferences #43984

Merged
merged 1 commit into from May 7, 2021

Conversation

sheetalkamat
Copy link
Member

This one should help with TypeStrong/ts-loader#1274

@sheetalkamat
Copy link
Member Author

Ping i would like to get this in for 4.3.1

@sheetalkamat sheetalkamat merged commit e5395ef into master May 7, 2021
@sheetalkamat sheetalkamat deleted the transformersToBuild branch May 7, 2021 19:13
@johnnyreilly
Copy link

Tremendous!

@gauriramesh
Copy link

Thanks so much @sheetalkamat !

@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.3.1 milestone May 20, 2021
@gasnier
Copy link

gasnier commented Jun 5, 2021

@sheetalkamat
Once again, thanks for this PR.

I tried to use it and it is finally not sufficient for ts-loader in watch mode

When we build in watch mode, we use createSolutionBuilderWithWatch and the rebuild is initiated by the SolutionBuilderWorker by calling buildNextInvalidatedProject which then calls "done" on the invalidated project without the customTransformers.

Would it be possible to add the same parameter "getCustomTransformers?: (project: string) => CustomTransformers"
to createSolutionBuilderWithWatch and pass it all the way to buildNextInvalidatedProject ?


Also, last year you optimised the project references build in ts-loader but I am not sure to understand how it works.

in instances.ts (https://github.com/TypeStrong/ts-loader/blob/main/src/instances.ts) line 483 function buildSolutionReferences

if (!instance.solutionBuilderHost) {
    ...
    instance.solutionBuilderHost = makeSolutionBuilderHost(...)
    const solutionBuilder = instance.compiler.createSolutionBuilderWithWatch(instance.solutionBuilderHost,...)
    ...
} else {
    instance.solutionBuilderHost.buildReferences();
}

Within buildReferences I don't find any 'build' call... but when I debug the 'timeout functions' I find the buildNextInvalidatedProject calls (file https://github.com/TypeStrong/ts-loader/blob/main/src/servicesHost.ts line 894)

If we add getCustomTransformers parameter to createSolutionBuilderWithWatch will it be sufficient or do we have to pass it to the solutionBuilderHost in some way ?

Thanks.

Also, should I create a ticket ?

ping @johnnyreilly

@johnnyreilly
Copy link

I'd just use the discussion here for now - it has the context.

sheetalkamat added a commit that referenced this pull request Jun 7, 2021
…tting.

This allows not having to specify the transformers during normal watch scneario
Builds on top of #43984
sheetalkamat added a commit that referenced this pull request Jun 7, 2021
…tting. (#44489)

This allows not having to specify the transformers during normal watch scneario
Builds on top of #43984
sheetalkamat added a commit that referenced this pull request Jun 7, 2021
…tting.

This allows not having to specify the transformers during normal watch scneario
Builds on top of #43984
DanielRosenwasser pushed a commit that referenced this pull request Jun 16, 2021
…tting. (#44496)

This allows not having to specify the transformers during normal watch scneario
Builds on top of #43984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants