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

Use import to load plugins #14132

Merged
merged 12 commits into from
Aug 8, 2024
Merged

Use import to load plugins #14132

merged 12 commits into from
Aug 8, 2024

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Aug 6, 2024

Alternative to #14110

This PR changes the way how we load plugins to be compatible with ES6 async imports. This allows us to load plugins even inside the browser but it comes at a downside: We now have to change the compile API to return a Promise...

So most of this PR is rewriting all of the call sites of compile to expect a promise instead of the object.

Copy link
Member

@adamwathan adamwathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your sacrifice 😄 Looks good!

@philipp-spiess philipp-spiess force-pushed the fix/plugin-dynamic-require branch 5 times, most recently from ad68313 to 6db1ab2 Compare August 8, 2024 10:12
@philipp-spiess philipp-spiess force-pushed the fix/plugin-dynamic-require branch 13 times, most recently from e4aa5ee to b122b9e Compare August 8, 2024 13:53
@philipp-spiess philipp-spiess force-pushed the fix/plugin-dynamic-require branch from b122b9e to a930cf4 Compare August 8, 2024 14:17
@thecrypticace thecrypticace merged commit 921b4b6 into next Aug 8, 2024
2 checks passed
@thecrypticace thecrypticace deleted the fix/plugin-dynamic-require branch August 8, 2024 15:49
philipp-spiess added a commit that referenced this pull request Aug 26, 2024
Closes #14253

Since we changed the export strategy for the postcss client in #14132,
we accidentally no longer generated type exports for this package.

This PR adds a type export back. We now use a similar pattern to the
`./colors` and `./defaultTheme` exports in the tailwindcss package where
we have a separate cjs entrypoint.

The changes were validated manually in a playground project that were
installing the updated dependencies from tarballs.

Here is one example of it working as expected:
 
<img width="750" alt="Screenshot 2024-08-26 at 14 10 07"
src="https://github.com/user-attachments/assets/83de15f2-1543-4805-9231-9b8df1636c5e">
philipp-spiess added a commit that referenced this pull request Aug 27, 2024
Closes #14253

Since we changed the export strategy for the postcss client in #14132,
we accidentally no longer generated type exports for this package.

This PR adds a type export back. We now use a similar pattern to the
`./colors` and `./defaultTheme` exports in the tailwindcss package where
we have a separate cjs entrypoint.

The changes were validated manually in a playground project that were
installing the updated dependencies from tarballs.

Here is one example of it working as expected:
 
<img width="750" alt="Screenshot 2024-08-26 at 14 10 07"
src="https://github.com/user-attachments/assets/83de15f2-1543-4805-9231-9b8df1636c5e">
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.

4 participants