Skip to content

Optimize language service build #520

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

Merged
merged 1 commit into from
Apr 13, 2022
Merged

Optimize language service build #520

merged 1 commit into from
Apr 13, 2022

Conversation

remcohaszing
Copy link
Contributor

tsdx uses .browserslistrc to determine how to transpile the source code. By default it supports very old environments.

By specifying relatively modern targets, the bundle size has been reduced with ~40%. This also significantly increases performance and readability of the output, because babel’s regenerator runtime isn’t used anymore.

The output target can’t be set to something too new, because tsdx uses an older version of terser which isn’t compatible with all new syntax (e.g. optional chaining).

Before this PR:

$ du -sh dist/*.js
4.0K	dist/index.js
192K	dist/tailwindcss-language-service.cjs.development.js
80K	dist/tailwindcss-language-service.cjs.production.min.js
192K	dist/tailwindcss-language-service.esm.js

After this PR:

$ du -sh dist/*.js
4.0K	dist/index.js
116K	dist/tailwindcss-language-service.cjs.development.js
56K	dist/tailwindcss-language-service.cjs.production.min.js
116K	dist/tailwindcss-language-service.esm.js

`tsdx` uses `.browserslistrc` to determine how to transpile the source
code. By default it supports very old environments.

By specifying relatively modern targets, the bundle size has been
reduced with ~40%. This also significantly increases performance and
readability of the output, because babel’s regenerator runtime isn’t
used anymore.

The output target can’t be set to something too new, because `tsdx` uses
an older version of terser which isn’t compatible with all new syntax
(e.g. optional chaining).
@bradlc
Copy link
Contributor

bradlc commented Apr 13, 2022

I dig it, thank you!

@bradlc bradlc merged commit 0616187 into tailwindlabs:master Apr 13, 2022
@remcohaszing
Copy link
Contributor Author

remcohaszing commented Apr 14, 2022

Do you have any ETA of when this will be released?

I understand the language server and VSCode extension don’t need a release of the language service, because they are linked in this mono repo and bundled when released, but I’d like to use these language service changes in monaco-tailwindcss. (Also I’d love to collaborate with the Tailwind team to work on this and integrate it in the playground.) 😄

@remcohaszing
Copy link
Contributor Author

I see you did! Thank you!

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