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

Clarification on Project references with webpack watch #846

Closed
jordond opened this issue Sep 30, 2018 · 9 comments
Closed

Clarification on Project references with webpack watch #846

jordond opened this issue Sep 30, 2018 · 9 comments
Assignees
Labels

Comments

@jordond
Copy link

jordond commented Sep 30, 2018

I'm looking for clarification on how to run webpack --watch with TS project references.

I followed the instructions in the README, and added WatchIgnorePlugin targeting .js and .d.ts files.

Now when I run webpack --watch and in a seperate terminal run tsc --build --watch, and make a change to one of the dependents, webpack never rebuilds because it's ignoring the compiled outputs.

So I'm just wondering the proper way to watch the referenced projects, and have webpack rebuild.

If I remove the WatchIgnore plugin, then webpack will rebuild multiple times, only stopping when tsc has finished building the changes. I have tried offseting this by adding

watchOptions: {
  aggregateTimeout: 5000
}

and adjusting the timeout, but it's more of a hack and isn't guarenteed to only reload once.

@johnnyreilly
Copy link
Member

@andrewbranch what's your view on this scenario?

@jordond
Copy link
Author

jordond commented Sep 30, 2018

Not sure if this matters, but I'm using path aliases in my root tsconfig.json:

./tsconfig.json
...
"baseUrl": ".",
"paths": {
  "@lib/*": ["lib/*"]
}
...

But I've done some testing and changed some of imports to regular imports, but there seems to be no difference.

@andrewbranch
Copy link
Contributor

Hm, interesting... this sounds like good justification for building the ability to recompile upstream projects into ts-loader, where we’ll have pretty tight control over which files are getting watched. I think the aggregateTimeout sounds like a good workaround in the meantime. I don’t think there’s anything ts-loader can do about it until ts-loader can rebuild projects, but this is a great thing to look out for if/when we implement that. @johnnyreilly sound reasonable to you?

@johnnyreilly
Copy link
Member

johnnyreilly commented Oct 4, 2018

Yeah sounds completely reasonable @andrewbranch!

Actually @jordond if you wanted to submit a docs PR suggesting this as an interim solution that might be a good idea. Doubtless other people are attempting similar and so sharing your workaround seems like it could be beneficial.

Thanks for posting it!

@andrewbranch andrewbranch self-assigned this Dec 1, 2018
@johnnyreilly
Copy link
Member

See #851

@Bnaya
Copy link

Bnaya commented Feb 4, 2019

TypeScript 3.3 supports incremental build with composite projects
https://github.com/Microsoft/TypeScript/wiki/Roadmap#33-january-2019

@stale
Copy link

stale bot commented Apr 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 5, 2019
@stale
Copy link

stale bot commented Apr 12, 2019

Closing as stale. Please reopen if you'd like to work on this further.

@stale stale bot closed this as completed Apr 12, 2019
@seawatts
Copy link

@jordond Was there any resolution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants