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

externalize jsx-runtime and get it working in the dev package #1074

Merged
merged 2 commits into from
Apr 19, 2022

Conversation

frehner
Copy link
Contributor

@frehner frehner commented Apr 12, 2022

Before this change, we were creating a local version of the jsx-runtime file in the hydrogen-ui package: here's some screenshots showing the local import and the dist folder after building:

Screen Shot 2022-04-12 at 4 14 55 PM

Screen Shot 2022-04-12 at 4 14 39 PM

However, I believe the jsx-runtime library should be found during the app's buildtime (not hydrogen-ui's buildtime), so we want to externalize it. In doing so, there appears to be an issue with Vite's built-in React plugin, so we need to help it out by adding it to the optimizeDeps array. So I documented that as well.

For reference, here's what it looks like after these change:

Screen Shot 2022-04-12 at 4 19 06 PM

Screen Shot 2022-04-12 at 4 19 02 PM

Looks better!

@frehner frehner mentioned this pull request Apr 12, 2022
3 tasks
@frehner frehner requested a review from a team April 12, 2022 22:24
@@ -6,7 +6,7 @@ import shopifyConfig from './shopify.config';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [hydrogen(shopifyConfig)],
optimizeDeps: {include: ['@headlessui/react']},
optimizeDeps: {include: ['@headlessui/react', 'react/jsx-runtime']},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add this in the Hydrogen plugin directly? Just so we don't bother users with upstream workarounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@github-actions
Copy link
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run "yarn changeset add" to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

@frehner
Copy link
Contributor Author

frehner commented Apr 13, 2022

Updated!

@frehner frehner merged commit 6d8df10 into v1.x-2022-07 Apr 19, 2022
@frehner frehner deleted the jsx-runtime branch April 19, 2022 20:27
blittle added a commit that referenced this pull request Apr 19, 2022
* v1.x-2022-07:
  externalize jsx-runtime and get it working in the dev package (#1074)
  [Hydrogen docs]: Version 0.16.0 release (#1100)
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