protibimbok / django-vite-plugin

This plugin configures Vite for use with Django backend.
112 stars 14 forks source link

Error in output example for vite dev server #66

Closed GrCOTE7 closed 1 month ago

GrCOTE7 commented 2 months ago

Hi,

After clone of your project, I done :

@:django-vite-plugin\example\output>pip install django_vite_plugin

And :

@:django-vite-plugin\example\output>npm install django-vite-plugin

Then

@:django-vite-plugin\example\output>npm i

After, I start the python server, and the http://127.0.0.1:8000/ page shows:

Exception at /

Vite dev server is not started!

Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 5.1 Exception Type: Exception Exception Value:

Vite dev server is not started!

And in CLI,

@:django-vite-plugin\example\output>npm run dev

shows: The plugin "externalize-deps" was triggered by this import

vite.config.js:2:33:
  2 │ import { djangoVitePlugin } from "django-vite-plugin";
    ╵                                  ~~~~~~~~~~~~~~~~~~~~

failed to load config from C:\laragon\www\django-vite-plugin\example\output\vite.config.js error when starting dev server: Error: Build failed with 1 error: node_modules/esbuild/lib/main.js:1225:27: ERROR: [plugin: externalize-deps] Failed to resolve entry for package "django-vite-plugin". The package may have incorrect main/module/exports specified in its package.json. at failureErrorWithLog (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:1472:15) at C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:945:25 at runOnEndCallbacks (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:1315:45) at buildResponseToResult (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:943:7) at C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:970:16 at responseCallbacks. (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:622:9) at handleIncomingPacket (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:677:12) at Socket.readFromStdout (C:\laragon\www\django-vite-plugin\example\output\node_modules\esbuild\lib\main.js:600:7) at Socket.emit (node:events:519:28) at addChunk (node:internal/streams/readable:559:12)

Can you say me where I will fix this?

protibimbok commented 2 months ago

Sorry for not mentioning the development process in the docs. You don't need this:

@:django-vite-plugin\example\output>npm install django-vite-plugin

And instead of

@:django-vite-plugin\example\output>pip install django_vite_plugin

I use junctions to keep my development and testing in sync.