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

fix(@ngtools/webpack): fix #7615, check if this.done is defined before delaying resolvers #7619

Merged
merged 1 commit into from
Sep 13, 2017

Conversation

rezonant
Copy link
Contributor

@rezonant rezonant commented Sep 7, 2017

Resolves #7615

@rezonant rezonant changed the title Fix for 7615: Check if this.done is defined before delaying resolvers fix(@ngtools/webpack): fix #7615, check if this.done is defined before delaying resolvers Sep 7, 2017
@@ -390,7 +390,7 @@ export class AotPlugin implements Tapable {
// Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
// when the issuer is a `.ts` file.
compiler.resolvers.normal.plugin('before-resolve', (request: any, cb: () => void) => {
if (request.request.endsWith('.ts')
if (this.done && request.request.endsWith('.ts')
|| (request.context.issuer && request.context.issuer.endsWith('.ts'))) {
this.done!.then(() => cb(), () => cb());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, could you remove the ! here? It won't be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -390,9 +390,9 @@ export class AotPlugin implements Tapable {
// Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
// when the issuer is a `.ts` file.
compiler.resolvers.normal.plugin('before-resolve', (request: any, cb: () => void) => {
if (request.request.endsWith('.ts')
if (this.done && request.request.endsWith('.ts')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad logic? shouldn't it be:

        if (this.done
            && (request.request.endsWith('.ts')
                || (request.context.issuer && request.context.issuer.endsWith('.ts')))) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I missed the second line (not a fan of the line break here). Fixed in next version.

Check if this.done is defined before delaying file access
@angular-automatic-lock-bot
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.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'then' of undefined when used with serviceworker-webpack-plugin
4 participants