@goesvt/svelte-use-env

1.0.9 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.9
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.9
    0
  • 1.0.8
    0
  • 1.0.7
    0

Package Sidebar

Install

npm i @goesvt/svelte-use-env

Weekly Downloads

0

Version

1.0.9

License

MIT

Unpacked Size

1.72 kB

Total Files

3

Last publish

Collaborators

  • goesnow