Skip to content
Discussion options

You must be logged in to vote

Use vite-node:

{
	"scripts": {
		"seed": "vite-node --options.transformMode.ssr='/.*/' src/lib/util/seed.ts"
	},
	"devDependencies": {
		"vite-node": "^0.30.1"
	}
}

--options.transformMode.ssr='/.*/' makes sure that vite runs this code as a server, rather than a client. You need this to be able to access private env variables.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kelbyfaessler
Comment options

Answer selected by kelbyfaessler
Comment options

You must be logged in to vote
1 reply
@enisbudancamanak
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants