Sunday, April 15, 2018

Make laravel mix to use a specific .env file - development

Make laravel mix to use a specific .env file

With laravel mix I can specify a .env to include some variables into my project.

Is it possible to make mix use my file .env.development when NODE_ENV=development? Right now, mix just keeps grabbing the .env file and ignoring the .env.development file.

Is it possible to somehow configure this?

My current package.json:

{ "scripts": { "dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "rmdist": "rimraf dist" }, ... 

My current webpack.mix.js:

 let mix = require('laravel-mix'); mix.setPublicPath('dist') .js('src/app.js', 'scripts/') .extract([ 'jquery', 'axios', 'babel-polyfill', 'lodash', 'tether', 'vue', 'bootstrap-vue', 'vuex', 'vuex-localstorage' ]) .sass('src/styles/app.scss', 'styles/') .copyDirectory('src/assets', 'dist/assets') .options({ processCssUrls: false, uglify: true }) .version(); if (process.env.NODE_ENV === 'development') mix.sourceMaps(); 

submitted by /u/sqzr1
[link] [comments]



from Laravel Questions and Answers https://laravelquestions.com/rlaravel/make-laravel-mix-to-use-a-specific-env-file/
via Lzo Media

No comments:

Post a Comment