-
Notifications
You must be signed in to change notification settings - Fork 660
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
[5.x] Change Laravel Mix asset bundling to Vite setup #1413
Conversation
889ee05
to
9739b99
Compare
improve asset publishing change formatting ww fix ci
9739b99
to
dca9a81
Compare
We'll also want to pass in the right command ( |
Thanks btw! This is great. |
@driesvints the default command for the compile assets workflow is If this gets merged, then I'll update the laravel/telescope package with the same changes too |
ah nvm. We usually use |
vite.config.mjs
Outdated
input: { | ||
"app-css": "resources/sass/app.scss", | ||
"app-dark-css": "resources/sass/app-dark.scss", | ||
app: "resources/js/app.js", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vite doesn't inline the css of the file Alert component into JS anymore (public/build/app.css
) but puts it into a css file with the same filename as the entry javascript file. unfortunately the app.scss file has the same name as the main js entrypoint and therefore vite detects a name conflict and adds an incrementing number to the filename until its unique in the output folder.
when reviewing this, just change this workaround to this and rebuild, then you can see what I mean. With this approach, I tried to be as compatible as possible with the previous output format of webpack.
input: { | |
"app-css": "resources/sass/app.scss", | |
"app-dark-css": "resources/sass/app-dark.scss", | |
app: "resources/js/app.js", | |
}, | |
input: [ | |
"resources/sass/app.scss", | |
"resources/sass/app-dark.scss", | |
"resources/js/app.js", | |
], |
another solution would be to move the styles from the SFC <style></style>
tag on the Alert Vue component directly to the scss files, but if future changes to the vue files happen and someone wants to add component based styles with the Vue SFC style tags then the same issue will happen again as outlined above
I can add screenshots later if any questions come up
For horizon v6.x we could make a „breaking change“ to rename either the app.js or app.scss entrypoint and avoid naming collisions. (I suppose there is no big UI refactoring planned for the 5.x release anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and renamed the There are basically three files now that will change behaviour on user side in the
When user publish the horizon assets they will end up with 3 new files and 3 old files that are not cleaned up automatically if this is an issue, then I will need to send this PR to the 6.x branch Let me know @driesvints |
I don't think letting the old files remain is a big issue. As long as the new files are there and picked up it's fine. |
This reverts commit 3c6661d.
…el#1413)" (laravel#1418) This reverts commit 6667681.
So as far as I understand, is it safe to upgrade, republish assets and then manually delete these files?
|
This moves the current laravel mix asset bundling setup to the recommended way of bundling with Vite.