Skip to content

A nuxt.js module that loads your .env file into your context options | The project has moved to the Nuxt-Community ๐Ÿš€

License

Notifications You must be signed in to change notification settings

JulienTant/nuxtjs-dotenv-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

The project has moved to the Nuxt-Community ๐Ÿš€ https://github.com/nuxt-community/dotenv-module

nuxtjs-dotenv-module

npm (scoped with tag) npm CircleCI Codecov Dependencies

js-standard-style

A nuxt.js module that loads your .env file into your context options

๐Ÿ“– Release Notes

Features

The module loads variables from your .env file directly into your nuxt.js application context and process.env.

Setup

  • Add nuxtjs-dotenv-module dependency using yarn or npm to your project
  • Add nuxtjs-dotenv-module to modules section of nuxt.config.js
{
  modules: [
    // Simple usage
    'nuxtjs-dotenv-module',

    // With options
    ['nuxtjs-dotenv-module', { /* module options */ }],
 ]
}

Usage

After creating your .env file in the project root, simply run your usual npm run dev. The variable inside the .env file will be added to the context (context.env) and process (process.env)

if for some reason you want to restrict what's accessible into the context, you can can pass to the module options an only array with the keys you want to allow.

{
  modules: [
    ['nuxtjs-dotenv-module', {only: ['some_key']}],
  ]
}

License

MIT License

Copyright (c) Julien Tant [email protected]

About

A nuxt.js module that loads your .env file into your context options | The project has moved to the Nuxt-Community ๐Ÿš€

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published