nystudio107 / craft-vite

Allows the use of the Vite.js next generation frontend tooling with Craft CMS
MIT License
52 stars 16 forks source link

Having trouble getting it to work #23

Closed FrDH closed 2 years ago

FrDH commented 2 years ago

Hi, I'm trying to get this to work, but without much result. Here's my setup:

Craft version 3.7.8 Craft Vite plugin version 1.0.20 Local server: MAMP PRO Local URL: http://localhost/test.com/public_html/

First question would be: after installing the Craft Vite plugin, do I need to manually install Vite.js ? Or does the plugin do this for me? (I manually installed it using npm install vite --save-dev)

Second question: do I need to manually start the Vite server? After adding the scripts dev, build and preview to the package.json I'm able to do npm run dev and Vite will start a server at http://localhost:3000/. But following that link results in an ERR_CONNECTION_REFUSED error.

Am I missing something in the docs? Or should the above simply work and am I doing something wrong?

Thanks in advance!

khalwat commented 2 years ago

Yes, you have to install Vite.js yourself and run it however you want to run it.

You should not access the Vite dev server directly via http://localhost:3000/, you should access your website however you normally do in your local dev environment.

The Vite dev server is only for serving assets like JS, CSS, etc.

I think the issues you've having are unrelated to the Vite plugin itself.