Closed nrsk-slee closed 6 months ago
Hi @nrsk-slee, try to keep the setup for your theme app extension separate from your remix app. I have a theme app extension in our docs that you can look at. https://shopify-vite.barrelny.com/guide/example-projects.html#theme-app-extensions
~~Hi @montalvomiguelo , and thank you for your reply :) I will look into the example. I was thinking of building a public app, that the admin side & the theme app extension (app block), should be in one set. Is that still possible when separated?~~
After I looked into the example, I tried PNPM and it works. Thanks again for the advice 👍
@montalvomiguelo Hey, I have a standalone app(Remix), now I also want to add an extension to it. If I add it using the way shopify suggests, it works. However, writing pure js and css is really hard so I want to use React. I couldn't make shopify-vite work with my remix app. Is there a way? Can you briefly explain?
Hi there! Thank you for the wonderful vite plugin for Shopify!
I'm new to Shopify, and it's ecosystem :) I started to learn by following the Shopify's tutorial. After sometime, I ran into Theme App Extensions, and generated the extension via Shopify Cli,
shopify app generate extension
Also I found vite-plugin-shopify, and immediately adapted it. Later that, I added react() into vite.config.ts as I would like build it in React, however it didn't work.As written in subject, is it possible to use vite-plugin-shopify + React, along with Remix?
Occured Error
Identifier 'RefreshRuntime' has already been declared
error appears in both Shopify Admin (Remix), and theme app extension (vite-plugin-shopify)react()
around, do not solve anything.react()
, browser throwsRemix Vite plugin can't detect preamble.
error.remix()
, solves the issue and vite-plugin-shopify works as intended, however the Shopify Admin (remix) stops working.react()
along withremix()
, imports are duplicated.Sample of import section from the compiled .tsx, when viewed in Browser
Dependencies
remix: ^2.9.1 (Generated by
shopify app init
, and updated to the latest) react: ^18.3.1 (Generated byshopify app init
, and updated to the latest) vite-plugin-shopify: ^3.0.1 @vitejs/plugin-react: ^4.2.1Directory Structure
Code in .liquid
Code in theme.tsx
Plugins in vite.config.ts