Mealing icon indicating copy to clipboard operation
Mealing copied to clipboard

Migrate from Laravel Mix to Vite

Open JustinByrne opened this issue 2 years ago • 6 comments

This pull request includes changes for migrating from Laravel Mix to Vite outlined in Migration Guide and automated by the Vite Converter.

Before merging, you need to:

  • Checkout the shift-70028 branch
  • Run composer update
  • Run npm install
  • Review all comments for additional changes
  • Thoroughly test your application (no tests?, no CI?)

Please send your feedback to [email protected] or share the good vibes on Twitter.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:x: Shift did not remove some of the previous npm scripts running mix commands as they appeared to be customized. You should review the scripts configured in your package.json file and update any custom commands to use vite.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:information_source: Previously, Laravel configured several npm scripts for building assets. For Vite, Laravel configures a dev script for generating and watching your assets (for development) and build script for generating your assets (for production).

Shift automated this change by replacing commands using these scripts with their new Vite script. However, you may still be referencing these scripts in your code or in deployment scripts.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:information_source: Laravel renamed the environment variables used by Mix to use a VITE_ prefix, instead of MIX_. While Shift automated this change throughout your code, you should check for any additional references which may not be included in your Git repository.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:information_source: Vite requires JavaScript files containing JSX to have a .jsx file extension. Shift did not detect any JSX in files with a .js extension under the resources folder. However, if you are using JSX, be sure the files have a .jsx extension.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:warning: Vite generates frontend assets to the public/build folder. This folder is not tracked by Git within a default Laravel project. As such, Shift added this folder to your .gitignore file.

If you wish to track the generated frontend assets within your project, such as for ease of deployment, you may undo this commit by running git revert 92af209b.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne

:alembic: This Shift is still being refined. Please report any issues or suggestions to [email protected]. Your feedback is what helps improve the experience for everyone.

JustinByrne avatar Sep 04 '22 15:09 JustinByrne