Skip to content

Migrate project to Vite for asset bundling #167

Open
vivgui wants to merge 2 commits intouicrooks:devfrom
vivgui:main
Open

Migrate project to Vite for asset bundling #167
vivgui wants to merge 2 commits intouicrooks:devfrom
vivgui:main

Conversation

@vivgui
Copy link
Copy Markdown

@vivgui vivgui commented Jul 17, 2022

The project currently uses webpack for assets bundling but there's an interest in switching to Vite. This PR attempts to do that migration. I first tested this on the foundation theme (you can see my repo fork here) and things worked correctly.

One major thing that the migration to Vite changed is that Vite doesn't use .browserslistrc for setting browser compatibility, it uses esbuild instead so the .config/.browserslistrc file is not needed.

Besides that, I tried my best to replace all the webpack-specific functionality using Vite plugins and configurations.

I know this is a significant change and I'm open to discussing how to best approach it. I just wanted to demonstrate that migrating to Vite is possible and worthwhile.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the dev branch, not the main branch

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@montalvomiguelo
Copy link
Copy Markdown

Hey guys, at barrel created a Vite/Shopify plugin that I think you will love (:

vite-plugin-shopify.mp4

@vivgui
Copy link
Copy Markdown
Author

vivgui commented Jul 19, 2022

@montalvomiguelo what's the github repo? would like to take a look

@montalvomiguelo
Copy link
Copy Markdown

@vivgui
Copy link
Copy Markdown
Author

vivgui commented Aug 31, 2022

I wanted to follow up on this, is there anything you want me to change/talk about before this can be approved?

@adotrevino
Copy link
Copy Markdown

when is this going to be approved?

@curiouscrusher
Copy link
Copy Markdown

+1 would love to see this implemented!

@Chadyka
Copy link
Copy Markdown

Chadyka commented Nov 12, 2022

+1 this is just what I'm missing from the current implementation

@pablogiralt
Copy link
Copy Markdown

+1

1 similar comment
@james0r
Copy link
Copy Markdown

james0r commented Jan 25, 2023

+1

@james0r
Copy link
Copy Markdown

james0r commented Jan 26, 2023

Adapted OP's Vite implementation for use with Alpine.js if anyone wants to check it out here. Havn't got it working with Shopify CLI v3 yet.

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.

7 participants