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

fix: update Vite config for example apps [EXT-6273] #9593

Merged
merged 14 commits into from
Mar 24, 2025

Conversation

whitelisab
Copy link
Contributor

Purpose

We updated the example apps to use Vite instead of CRA/react-scripts in this PR. However, a few things were missed, so this PR aims to clean those up. We fixed up the delivery function examples in this other PR, so this current PR updates the rest of the examples that were migrated to Vite.

Approach

Here's an overview of the changes:

Vite updates

  • Ensure Vite, Vitest, @vitejs/plugin-react and any other dependencies are up to date
  • Ensure that in the Vite config, the build directory is set to ./build instead of the default ./dist. We are standardizing on this for our examples because the build-functions script from the @contentful/app-scripts package expects this to be the name for the build directory. Even for apps that don't have functions, we want to be consistent in case the user adds functions to their app.
  • Add `"base": ''" to the Vite config to support relative paths, more info here
  • Ensure Vitest is configured properly; add /// <reference types="vitest/config" /> when using Vitest, adding the triple slash command as documented here
  • Rename the Vite config file to address this warning
  • Add start script in package.json in addition to to dev

tsconfig.json updates

  • Remove the CRA tsconfig and the associated react-app-env.d.ts file; add any necessary configuration after removing that
  • Ensure that the functions directory has its own tsconfig.json like our function templates

Documentation updates

  • Remove references to Create React App in README files

Example-specific changes

The app-actions app did not need to be updated to Vite since it already uses next. So I reverted the changes that were previously made.

Testing steps

I tested these locally in the apps repo and also tested them using CCA according these instructions. I ran the apps locally and also built and uploaded them.

Breaking Changes

Dependencies and/or References

Deployment

@whitelisab whitelisab requested a review from a team as a code owner March 24, 2025 19:33
@wiz-inc-38d59fb8d7
Copy link

wiz-inc-38d59fb8d7 bot commented Mar 24, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities
Data Finding Sensitive Data
Secret Finding Secrets
IaC Misconfiguration IaC Misconfigurations
Total

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Copy link

netlify bot commented Mar 24, 2025

Deploy Preview for ecommerce-app-base-components canceled.

Name Link
🔨 Latest commit 3fc2ff3
🔍 Latest deploy log https://app.netlify.com/sites/ecommerce-app-base-components/deploys/67e1b72a0d08e50008d62c35

@whitelisab whitelisab merged commit 23a6ff7 into master Mar 24, 2025
17 checks passed
@whitelisab whitelisab deleted the fix/ext-6273-other-examples branch March 24, 2025 20:33
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