Env for laravel/elixir with browserify

197 views Asked by At

what is the solution for using environment variables in javascript projects with browserify?
In my current project I'm using laravel with elixir and browserify and I was trying to add envify but I don't know how to implement it into my elixir code:

//gulpfile.js

elixir(function(mix) {
   mix.browserify(['app.jsx'], 'public/js/app.js');
});

Basically I need env for api urls (dev/prod) so it would be best to have .env.json in the root and then somehow get those variables into my js code.

Any ideas or better solutions?

0

There are 0 answers