torenware / vite-go

Go module to integrate Vue 3, React, and Svelte projects with Golang web projects using Vite 2 and 3
Other
206 stars 10 forks source link

examples/sample-program with preview mode doesn't start up #6

Open t2y opened 10 months ago

t2y commented 10 months ago

I can run with dev mode, but I cannot run with preview (production) mode. Is there any workaround?

$ make preview 
...
building go binary...
run test_program
2023/11/16 11:31:37 open dist/manifest.json: file does not exist
make: *** [Makefile:58: preview] Error 1

But it seems the manifest.json exists.

$ ls -l ./dist/manifest.json 
-rw-rw-r-- 1 t2y t2y 412 Nov 16 11:31 ./dist/manifest.json

I tried to run it manually, but it failed.

$ ./test_program -env production -assets ./dist/assets -dist ./dist 
2023/11/16 11:33:22 open ./dist/manifest.json: file does not exist
t2y commented 9 months ago

I should have specified frontend as an assets directory, but it still failed.

$ go run main.go -env production -assets ./frontend -dist ./dist
t2y commented 9 months ago

The frontend directory also should have a dist directory?

t2y commented 9 months ago

This is a workaround that works for me.

$ make preview
...
2023/11/17 13:29:11 open dist/manifest.json: file does not exist
make: *** [Makefile:58: preview] Error 1
$ cp -ar dist/ frontend/
$ make preview