Package Exports
- mix-env-file
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mix-env-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mix-env-file
Allows Laravel Mix to use to a specific .env file
By default mix only allows variables from a single file, .env, in the root of the project. This simple plugin will override the environment varibles from .env with a specified env file.
This is especially useful when building locally or on a build server then deploying to different locations.
Installation
$ npm install mix-env-fileor
$ yarn add mix-env-fileUsage
Update scripts in package.json to include a ENV_FILE environment variable:
"dev": "NODE_ENV=development ENV_FILE=./.env.test node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",OR run npm/yarn with an environment variable:
ENV_FILE=.env.production yarn run productionThen in webpack.mix.js file, require mix-env-file after laravel-mix.
let mix = require('laravel-mix');
require('mix-env-file');
// Then pass your file to this plugin
// If this is not set, this plugin won't do anything and the default .env variables will remain
mix.env(process.env.ENV_FILE);
...License
MIT