https://github.com/julientant/nuxtjs-dotenv-module
A nuxt.js module that loads your .env file into your context options | The project has moved to the Nuxt-Community 🚀
https://github.com/julientant/nuxtjs-dotenv-module
dotenv nuxt vue
Last synced: about 1 month ago
JSON representation
A nuxt.js module that loads your .env file into your context options | The project has moved to the Nuxt-Community 🚀
- Host: GitHub
- URL: https://github.com/julientant/nuxtjs-dotenv-module
- Owner: JulienTant
- License: mit
- Created: 2017-09-23T11:50:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-25T18:16:33.000Z (over 8 years ago)
- Last Synced: 2025-06-21T12:36:02.567Z (12 months ago)
- Topics: dotenv, nuxt, vue
- Language: JavaScript
- Homepage: https://github.com/nuxt-community/dotenv-module
- Size: 78.1 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# The project has moved to the Nuxt-Community 🚀 https://github.com/nuxt-community/dotenv-module
# nuxtjs-dotenv-module
[](https://npmjs.com/package/nuxtjs-dotenv-module)
[](https://npmjs.com/package/nuxtjs-dotenv-module)
[](https://circleci.com/gh/JulienTant/nuxtjs-dotenv-module)
[](https://codecov.io/gh/JulienTant/nuxtjs-dotenv-module)
[](https://david-dm.org/JulienTant/nuxtjs-dotenv-module)
[](http://standardjs.com)
> A nuxt.js module that loads your .env file into your context options
[📖 **Release Notes**](./CHANGELOG.md)
## 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`
```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.
```js
{
modules: [
['nuxtjs-dotenv-module', {only: ['some_key']}],
]
}
```
## License
[MIT License](./LICENSE)
Copyright (c) Julien Tant