Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: VS code will now properly import operators, et al#6276

Merged
benlesh merged 1 commit intoReactiveX:masterfrom
benlesh:fix/6067-fix-attempt-2
Apr 29, 2021
Merged

fix: VS code will now properly import operators, et al#6276
benlesh merged 1 commit intoReactiveX:masterfrom
benlesh:fix/6067-fix-attempt-2

Conversation

@benlesh
Copy link
Member

  • Adds typesVersions, enforcing TypeScript >= 4.2.
  • Adds some superfluous imports 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.

Fixes#6067
Relatedmicrosoft/TypeScript#43034

NOTE: I'm worried about thecheck-side-effects run 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-effects if it causes us issues.

@benlesh
Copy link
MemberAuthor

attn@filipesilva ... we're getting errors fromcheck-side-effects, however, there's no real change to the tree-shakability of what rxjs is outputting here from any of my tests (with angular-cli).

image

@benlesh
Copy link
MemberAuthor

benlesh commentedApr 28, 2021
edited
Loading

It does have me a little concerned thatrollup will have issues with this. Good grief, I had modules.@Rich-Harris, should rollup not like what we're doing here? It's admittedly bananas, but it seems to be working otherwise.

@benlesh
Copy link
MemberAuthor

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
Copy link
Collaborator

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.

tonivj5 reacted with eyes emoji

@Rich-Harris
Copy link

Unfortunately I got different results. I added atmp/index.js file with a single line:

import'../dist/esm5_for_rollup/index.js';

Running the following onmaster afternpm run compile...

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, becausedist/esm5_for_rollup/index.js contained the new directory imports...

import'./ajax';import'./fetch';import'./operators';import'./testing';import'./webSocket';

...which Rollup chafes at (since native loaders don't handle directory imports). Appending/index.js to each of the imports allowed the command to run, but it yielded a 91kb file.

benlesh and cartant reacted with thumbs up emoji

@benlesh
Copy link
MemberAuthor

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
@benleshbenleshforce-pushed thefix/6067-fix-attempt-2 branch from057aaf5 toa1a46fdCompareApril 28, 2021 19:17
@benlesh
Copy link
MemberAuthor

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
Copy link
MemberAuthor

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kwonojkwonojkwonoj approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[v7] TS automatic imports in VSCode default to wrong path

4 participants

@benlesh@cartant@Rich-Harris@kwonoj

[8]ページ先頭

©2009-2026 Movatter.jp