Skip to content

leon-dunamu/svelte-use-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svelte withe environment variables

The sveltejs/template starter project doesn’t allow the use of environment variables out-of-the-box.

Env can be used by using this module with svelte.



how to use


installation

npm install @goesvt/svelte-use-env

useage

Just following below code.

in rollup.config.js file

... import insertEnv from "@goesvt/svelte-use-env"; const production = !process.env.ROLLUP_WATCH; ... export default { ..., plugins : [ ..., insertEnv(), // insert here !! ], ... }

then, you can create & use .env file as follows

APP_KEY=vr9e29399g83gnrvesd

/* App.js */ console.log(process.env.APP_KEY); // vr9e29399g83gnrvesd

About

use env for svelte/templates

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published