set-node-process-env
v0.0.1
Published
set node.js process env for PORT_ENV
Downloads
3
Maintainers
Readme
set-node-process-env
set-node-process-env by linux bash command without need git ignore the .env file
https://www.npmjs.com/package/set-node-process-env
install
$ yarn global add set-node-process-env
# OR
$ npm i -g set-node-process-env
usage
# PORT_ENV for webpack
$ snpe PORT_ENV=8090
demo
// webpack.config.js
const PORT = process.env.PORT_ENV || 8080;
console.log('PORT_ENV =', process.env.PORT_ENV);
// const ip = require('ip');
// const hostIp = ip.address();
const config = {
// ...
devServer: {
// ...
// host: hostIp,
port: PORT_ENV || 8080,
proxy: [
{
context: ['/web/api/'],
// dev
target: 'https://web-dev.xgqfrms.xyz',
// prod
// target: 'https://web-prod.xgqfrms.xyz',
},
],
},
};
module.exports = config;
refs
https://www.npmjs.com/package/app-node-env