deck9 / input

A privacy-focused, no-code, open-source form builder designed for simplicity and brand consistency.
https://getinput.co
GNU Affero General Public License v3.0
162 stars 27 forks source link

Migrate from Laravel Mix to Vite #67

Closed PhilReinking closed 1 year ago

PhilReinking commented 1 year ago

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:

Please send your feedback to shift@laravelshift.com or share the good vibes on Twitter.

PhilReinking commented 1 year ago

: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.

PhilReinking commented 1 year ago

:warning: Shift detected you are using Vue. As such, Vite recommends importing your CSS from your JavaScript entry point. This will improve you development experience by avoid flashes of unstyled content during hot reloading.

Shift removed your CSS entry point from your Vite configuration. However, you will need to import this CSS in your JavaScript entry point.

PhilReinking commented 1 year ago

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

PhilReinking commented 1 year ago

: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 9bcb6036.

PhilReinking commented 1 year ago

:warning: Shift detected you are using Inertia. You may need to update your require statement for Vue components as well as configure an entry point if you are using SSR.

PhilReinking commented 1 year ago

:information_source: The new @vite Blade directive outputs <script> tags with the type="module" attribute. This attribute implicitly defers the script. This is a difference from Laravel Mix which may change the execution order of the JavaScript on your page.

If you experience JavaScript errors relating to undefined references, you may need to reorder your scripts or add the defer attribute to any inline <script> blocks on your page.

PhilReinking commented 1 year ago

:alembic: This Shift is still being refined. Please report any issues or suggestions to shift@laravelshift.com. Your feedback is what helps improve the experience for everyone.

CLAassistant commented 1 year ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: PhilReinking
:x: laravel-shift
You have signed the CLA already but the status is still pending? Let us recheck it.

what-the-diff[bot] commented 1 year ago
PhilReinking commented 1 year ago

Probably does work for development and self-hosted now. But could not figure out how to make the classic.js (form frontend) combine into one JS bundle including the CSS. Having it split in chunks and optimized, might it make more difficult to distribute.

Also need to get rid of the file hash for the classic.js

PhilReinking commented 1 year ago

Figured out the bundling of classic.js. I think we can move forward with this. Will not include it in the latest release.