-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Project reference support enhancements #1076
Conversation
311f421
to
8f384b6
Compare
This looks great @sheetalkamat! Thanks so much for your work 🌻🥰 I'm particularly interested in a review from @andrewbranch given his background with project references and Question: does this change the way people would use Is there anything else to be aware of? |
It builds all references in memory and hands off to webpack if asked |
Add test that doesnt pass yet. This is same as projectReferencesWatch so technically only change should be in bundled emit to have out to be lib\out\index.js instead
…pending on .ts file for that This fixes initial build to complete in single pass
…e in them can result in errors resulting in changes to the own output of the file
8f384b6
to
bf49856
Compare
Thanks for coming back to this, Sheetal! My main question is how this interacts with the My understanding is that with project references, you do get semantic errors reported for referenced projects even with
Second question: I see that Webpack is aware of generated tsbuildinfo and declaration files, but I can’t tell whether they’re actually written to disk or not. I think one of the main reasons people are excited about project references with ts-loader is startup performance—with |
@andrewbranch: On tsbuildInfo and tsc -b optimizations: Here is more detailed explaination of why .tsbuildinfos from the disk cannot be used for the initial build:
|
Re
In a future update, would it be possible (in addition to giving them to Webpack) to write these files to some cache location to improve startup time? So on a subsequent Webpack build, we could perform an up-to-date check, and if it passed, just give the content from the cached JS files to Webpack? Do we have the APIs to support that? |
@andrewbranch Actually original issue in writing and reading files for referenced projects to disk was they were written when building and that would confuse webpack.. Now with eb4b4fc it retains keeps them memory and hands off to webpack to write to disk so everything works out correctly as expected with additional benefit of working like |
Amazing work @sheetalkamat!
@andrewbranch I must confess I got confused even reading the paragraph 😉 Quite seriously I think considering the developer experience is important. If it's too complicated then people either won't use it, or won't use it right and will report "bugs" that really represent confusion. At present, if you're using I'd love it if we could find a way forward here. Also, we some things that may help us too. TypeStrong/fork-ts-checker-webpack-plugin#187 (comment)
If there's collaboration required between |
I see that @sheetalkamat is still working on this which is tremendous! We got some failing builds on node 8 in Travis which I've requeued. Incidentally I'm considering dropping support for node 8 now it's reached end of life. If you'd like to do that as part of this PR you have my blessing @sheetalkamat 🤗; just delete this line of code: Line 7 in d0c4b41
I'm glad we've started the I'm very much a believer in shipping incremental improvements as often as you can. On that, just shipping this PR would be a tremendous win for the community. We could provide an advisory note along the lines of "you can expect this to work as hoped where Just wanted to add this into the mix. |
…t handled so it didnt show correct output
…d suite during tests instead of commandline to avoid breaking older runs
@johnnyreilly completely agree with getting this in.. I am just trying to get all the tests to pass. Have ran into multiple issues with comparison tests esp when applying patches.. |
I've requeued the failing jobs a bunch of times in Travis. The behaviour is strange. My observations:
We used to have something in place that reran failing comparison tests repeatedly given that they are flaky and will often fail and then pass. That doesn't seem to be in place now so we're seeing failures straight away. The node 10 / node 12 difference is super curious to me. My assumption is that you're developing with node 10? I'm curious if by switching to node 12 you'd get different output? i.e. is there genuinely different behaviour depending upon node version? That's possible and may even be legitimate. We won't be able to make comparison tests work on node 10 and 12 if that's the case. If it's different behaviour but crucially still correct / functional we may want to consider running some tests conditionally based upon the node version. I'm slightly getting ahead of myself here, but I wanted to feed in some options / thoughts Great work! 🤗 |
@johnnyreilly I am using node 12. Thats why its surprising to see it fail.. I dont seem to see that failure any time at all.. May be i should just remove the timeout i added in 9d62b44 I did that to make sure that tests have same baseline as what actually happens but it is prone to timing issues.. (Without that tests dont show the correct behaviour eg. changing libFile doesnt show change in bundle.js in transpile because it happens in two rounds of compilation - one provides updated lib.js as asset to webpack and next one updates the bundle.js with that content but since we were only capturing first one, our baseline bundle.js doesnt have changed lib file content which is what i was trying to fix in that commit) |
…hat doesnt match actual behavior This reverts commit 9d62b44.
6205bcc
to
7b0ec7d
Compare
We have passing tests! Celebrate 🥰🌻 @sheetalkamat is there any more you want to add to this PR? @andrewbranch unless Sheetal says otherwise, I believe we're pretty much there, when you have a moment could you give this a once over please? Following on from the discussion earlier, I think this PR represents getting If everyone is happy I'd propose we release this. In terms of specifics it's probably good to bump the major version and mention we're not supporting node 8 anymore. To do that we'll just need this to jump to Line 3 in d0c4b41
And an entry in the CHANGELOG.md as well |
It's great to hear that I'm still working on the rewrite of the |
@johnnyreilly No nothing more. Note that to get the tests pass, i reverted tests to old behaviour that means in some cases they dont represent correct behavior (7b0ec7d) |
Just published https://github.com/TypeStrong/ts-loader/releases/tag/v7.0.0 Should appear on npm shortly! Thanks for your work @sheetalkamat and @andrewbranch 🥰🌻 |
See also @piotr-oles work in progress on project references support in |
* Add test for package json existance * Add input file of reference as dependency instead of .d.ts file * Show how output is different when module resolution resolves to .js/.d.ts * Store tsbuildinfos written on solution builder host and hand it off as asset * .d.ts as assets only if written * Make every project include just app and not other lib files * Fix watching for solution watched files Add test that doesnt pass yet. This is same as projectReferencesWatch so technically only change should be in bundled emit to have out to be lib\out\index.js instead * Dont depend on .d.ts output of the referenced project since we are depending on .ts file for that This fixes initial build to complete in single pass * Make sure to build all solution builder files before and track input and output * Add all the files from composite project as dependencies as any change in them can result in errors resulting in changes to the own output of the file * Get output from solutionBuilder for referenced files in transpileOnly mode as well * Read and write output files from referenced projects to disk * Test on already built * Handle written files by solution builder a bit better * Fix comparison tests where the multiple compilation callbacks were not handled so it didnt show correct output * Because comparison tests are run only on newer typescript build, build suite during tests instead of commandline to avoid breaking older runs * Remove node 8 build from travis * Fix test baselines * Revert multiple compilation stats per patch, has incorrect baseline that doesnt match actual behavior This reverts commit 9d62b44. * update package.json and CHANGELOG.md Co-authored-by: John Reilly <johnny_reilly@hotmail.com>
Continuation from #1028
With this the solution builder writes files to memory instead and we keep track of those (just like with normal build)
Things seem to be working now.
Add all input files of the referenced projects are dependency so that any change to them triggers build which can report errors