-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
[QUESTION] devServerInternal
allowed me to not have to touch the config or .env file
#2
Comments
Sure you can. Just set |
Right, that works, but...
previously, leaving this config in place, meant I never had to change anything to test a production build locally. Did leaving |
Yeah I was considering putting a I'll leave the issue open to see if anyone else wants to bring it back, too. |
Sounds good, thanks! Only reason I'd prefer a "no-change-necessary config" (whatever form that would take) is we have devs who come on to projects just to do certain backend work and don't need a front end dev server, just a working build. Maybe this is less of a problem now that Vite's devserver doesn't set your MacBook Pro on fire like Webpack. But, being able to tell them "hey just run |
Gotcha. Yeah I like the fallback functionality, it also is nice if you accidentally somehow ship it to production with it How are you liking Vite so far? |
I'm loving the local dev experience and lack of convoluted webpack config needed. I think I'm committed to sticking with it on at least one Craft project I'm working on. I'm still using a minimal webpack config just to one-off run the favicon generator and create the twig partial. Last thing I need to fully figure out is how to deal with src/images in the context of a Craft project. Mainly to use with Craft's svg function and the occasional one-off image that isn't a Craft asset. But Vite and Tailwind JIT is :chef-kiss: You? |
For the favicons, you probably can just run that directly rather than using webpack as an intermediary. All the webpack plugin does is call the npm favicons package anyway (it's just a wrapper). For me yeah it's on the roadmap basically, but I need to sort out:
Also keep in mind that Vite uses Rollup for the production build, so plugins may very well already exist: |
Anyway yeah so far I'm really enjoying Vite -- just exploring the unknown unknowns and such :) |
Alright @kylecotter I added this in via 69c7902 & nystudio107/craft-plugin-vite@758d042 It's in the 1.0.4 plugin release. It's optional now, and disabled by default -- you enable it via |
You’re the best!
|
While intentional or not, the
devServerInternal
config option let me set that to the Docker container running the Vite dev server and allowed me to leaveuseDevServer
always set to1
as it would automatically figure out if I was expecting amanifest.json
or the devserver url. (I think because you were checking if the devserver responded)This let me run the Vite
dev
script or thebuild
script without any sort of .env or config file change on the Craft side.With the removal of that setting, now I have to explicitly set
useDevServer
, which while manageable, means I can't just switch between a devserver or a production build locally. Maybe my desire is in the minority but figured I'd ask 🤷🏻♂️Thanks for the work on this!
The text was updated successfully, but these errors were encountered: