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

import as type and use named imports when possible #16387

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

schlawg
Copy link
Collaborator

@schlawg schlawg commented Nov 9, 2024

  • FEN, Role, Key, Dests, Piece, Color, Files, Ranks from chessground/types provided in global namespace via @types/lichess
  • chessops dependency hoisted to main package.json
  • chessops no longer loaded by all pages - instead confined to analysis, puzzles, some others
  • use import type whenever possible
  • prefer named imports unless benefits of secondary scoping are clear

it's never a bad idea to always import types like { type MyType } and prefer named imports as sometimes it can avoid including unnecessary code, although this is far less important now with code splitting.

this PR does reduce the overall assets downloaded on most pages (slightly). that's a consequence of reduced bundling due to import changes. it has some insignificant edits to speech/voice but aside from that, javascript should be the same. only types and names were changed - it's much safer than it probably looks.

@ornicar ornicar merged commit 082be62 into lichess-org:master Nov 10, 2024
2 checks passed
@schlawg schlawg deleted the ui-massage-imports branch November 10, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants