-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Typescript incremental builds using project references, test type checking, better dev workflow #4261
Conversation
… to remove later)
…e effect of testing scripts
…common settings, rename old lint-fix to prettier, add actual lint:fix using tslint parallel
@rosskevin After the failing docs issue is resolved, do you think this PR is ready for a full review? |
Ready for review. Any build/bundle improvements contemplated can be PR'd separately. |
Let's focus on the bundling changes first, and possibly extract them into a smaller PR that changes fewer things at once. Here's my current thinking on bundling vs. exploded modules, etc.:
|
I don't have a lot of time today/tomorrow but I'll do a quick pass on this to re-familiarize myself and get back to you within an hour. |
@rosskevin Alternatively, now that we're back from vacation, we can totally pick this up and do some of the heavy lifting to split the PR. We will cherry-pick your commits wherever we can. You've already done a lot of exploration, and we're grateful for that work! |
I'm not sure what you mean by that. Both the cjs and esm outputs are based on the index.ts.
Please feel free. I've got a release going out in the morning. Regarding splitting this, I would offer that I think that is a waste of time. This is primarily a build process change and it is exercised via tests Please don't forget, the netlify user script needs altered, it is doing duplicate work (even on master). |
And don't forget that apollo-boost is still not bundling in its dependencies, haven't had time to look into that yet (busy days). |
This is related to UMD only, so nothing downstream effected. Switching a size-checking strategy would obsolete it. |
Yes, but |
There is no guard against this as I detail here and in the link to material-ui-pickers pr. Webpack has indicated there will be no interop indicated here webpack/webpack#7973 The absolute only guard is to use only bundles. That is exactly why I made this recommendation here #4234 (comment). Summarizing:
If exploded paths are referenced by either |
You could still accidentally load both |
How would you do that? Using 80/20 rule which artifact strategy makes most sense for the most users? |
Here's the narrative that makes sense to me: If you're concerned about bundle sizes, make sure you're loading all Apollo Client packages using the In other words, I completely agree that the ESM entry point should be a single bundle, but I think it's fine if the I don't think we have to hold people's hands to make sure they only use the |
To create this commit, I first squashed all of @rosskevin's commits from new bundling strategy discussed in that PR. Once that was done, I rebased against origin/release-2.5.0 and fixed the conflicts. There are a few additional changes I'd like to make after this, but I wanted to preserve @rosskevin's intentions as much as possible in this commit, since it still has his name attached to it.
To create this commit, I (@benjamn) first squashed all of @rosskevin's commits from PR #4261 into one big commit, then reverted any changes that did not seem essential to the new bundling strategy discussed in that PR. Once that was done, I rebased against origin/release-2.5.0 and fixed the conflicts. With a few more minor tweaks, all tests are passing. I will push a few additional changes after this commit, but I wanted to preserve @rosskevin's intentions as much as possible here, since it still has his name attached to the commit.
To create this commit, I (@benjamn) first squashed all of @rosskevin's commits from PR #4261 into one big commit, then reverted any changes that did not seem essential to the new bundling strategy discussed in that PR. Once that was done, I rebased against origin/release-2.5.0 and fixed the conflicts. With a few more minor tweaks, all tests are passing. I will push a few additional changes after this commit, but I wanted to preserve @rosskevin's intentions as much as possible here, since his name is still attached to this commit.
Closing in favor of #4401, which includes many of these changes. Thanks for doing all this work @rosskevin! |
To create this commit, I (@benjamn) first squashed all of @rosskevin's commits from PR #4261 into one big commit, then reverted any changes that did not seem essential to the new bundling strategy discussed in that PR. Once that was done, I rebased against origin/release-2.5.0 and fixed the conflicts. With a few more minor tweaks, all tests are passing. I will push a few additional changes after this commit, but I wanted to preserve @rosskevin's intentions as much as possible here, since his name is still attached to this commit.
Revamp CJS and ESM bundling with Rollup (extracted from #4261)
Checklist:
What it does
This PR improves developer workflow, addresses some maintenance issues and simplifies builds with common configs. It also builds faster using ts incremental builds and adds type checking to all
src
including tests.Rationale
I got into the code to look at contributing to another issue, and noticed ts errors in my vscode workspace, specifically the tests. As I dug in, I noticed that tests aren't run against tsc, and the tsconfigs were duplicative and sometimes differing.
Goals
src
including testsChanges
IMPORTANT REVIEW NOTE
.ts
code changes were solely either a) addingany
; or b) the result of testing scripts and runningprettier
orlint:fix
on files which hadn't previously been touched. There is no intent here to change any runtime code, only build process and minimal changes to get tests type checking. Using diff options without spaces may help. To simplify getting tests to typecheck, they were left as much as-is as possible. These types can be incrementally improved moving forward.excludes
in tsconfigs).prettierrc
to prevent fighting between lint-staged and vscode prettier pluginany
for now to move past (effectively the same as before). These should be systematically improved in further PRs.Prepare
To be done in different PRs
I want to limit the size of this PR, so I have not continued on with my ultimate goals but will do the following using this PR as the basis:
strict: true
to expose more static type issuesany
in tests incrementallyTo be done by maintainers
npm i
in netlify - see Typescript incremental builds using project references, test type checking, better dev workflow #4261 (comment)