- Notifications
You must be signed in to change notification settings - Fork3k
fix: VS code will now properly import operators, et al#6276
fix: VS code will now properly import operators, et al#6276benlesh merged 1 commit intoReactiveX:masterfrom
Conversation
benlesh commentedApr 28, 2021
attn@filipesilva ... we're getting errors from |
benlesh commentedApr 28, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It does have me a little concerned that |
benlesh commentedApr 28, 2021
Yeah, I don't think we can get this fix into version 7 unless we're totally sure it's in the clear with everyone's bundlers. This isonly to fix auto imports in VS Code... as crazy as that is. So just waiting to have some experts weigh in. Hopefully we don't need to restructure our entire build to get things working in VS Code. :\ |
cartant commentedApr 28, 2021
FWIW, I did a small test with Rollup and the inclusion of the imports seems to make no difference to its output and tree shaking seems to work just fine. |
Rich-Harris commentedApr 28, 2021
Unfortunately I got different results. I added a import'../dist/esm5_for_rollup/index.js'; Running the following on npx rollup@latest -i tmp/index.js -o tmp/master.js -f esm ...yielded a 48kb (unminified) file. I switched to this branch and it failed at first, because import'./ajax';import'./fetch';import'./operators';import'./testing';import'./webSocket'; ...which Rollup chafes at (since native loaders don't handle directory imports). Appending |
benlesh commentedApr 28, 2021
Thank you so much,@Rich-Harris, for taking the time to look at this. So given this feedback, I think this PR is a no-go, and I'm going to close it. We're going to have to come up with another solution. |
- Adds typesVersions, enforcing TypeScript >= 4.2.- Adds some superfluous references required for TS and VS Code to find proper import locations for our strange deep import sites.- Independantly tested by building the package and installing it locally in another project, then testing in VS code.FixesReactiveX#6067Relatedmicrosoft/TypeScript#43034
057aaf5 toa1a46fdComparebenlesh commentedApr 28, 2021
All right, I've reopened this because there was another approach proposed by the TypeScript team, and it seems to be working! cc@cartant |
benlesh commentedApr 28, 2021
I've tested this with the methodology recommended by@Rich-Harris, and the output is identical between this branch and the master branch. So I think this is good to go. |

Fixes#6067
Relatedmicrosoft/TypeScript#43034
NOTE: I'm worried about the
check-side-effectsrun here, because it can't seem to figure out what to make of it. However, tested against an Angular build locally, this branch didn't have any problems tree-shaking or removing dead code. Given the importance of people getting their imports right, and the DX around this, we might want to disablecheck-side-effectsif it causes us issues.