Skip to content

Use dotenv-webpack from Laravel Mix to securely add environment variables to a bundle (Fork for update dependencies)

Notifications You must be signed in to change notification settings

mahpooya/dotenv-mix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Add the dotenv-webpack plugin to Laravel Mix to securely add dotenv and other environment variables and only expose what you use.

@mahpooya/dotenv-mix

Installation

npm install @mahpooya/dotenv-mix --save-dev

yarn add @mahpooya/dotenv-mix

const mix = require('@mahpooya/laravel-mix')
const env = require('@mahpooya/dotenv-mix')

// Register with Laravel Mix. You can use any name you want
mix.extend('env', env)

mix.js('resources/js/app.js', 'public/js')
    .env()

Usage

Once the component has been added to Mix no configuration is required. The .env file will be used by default.

To use a different file pass the path as the first argument to .env().

mix.env('.env.mix')

An options object can be passed as the second argument. This supports all the same options as dotenv-webpack (except path).

About

Use dotenv-webpack from Laravel Mix to securely add environment variables to a bundle (Fork for update dependencies)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%