const firebase = require('firebase');
const devConfig = {
//config here
};
const prodConfig = {
//config here
};
export const firebaseInit = firebase.initializeApp(process.env.NODE_ENV == 'development' ? devConfig : prodConfig);
export const rootRef = firebase.database().ref();
我有這個firebase配置文件。環境變量in heroku
我procfile我有:web: NODE_ENV=production node ./src/server/index.js
我有:
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV) || '"development"'
}
}),
,並在我的package.json我有:
"start": "node src/server/index.js",
"start:production": "NODE_ENV=production ./node_modules/.bin/webpack && node src/server/index.js",
"start:dev": "NODE_ENV=development ./node_modules/.bin/webpack && node src/server/index.js",
,並在我的Heroku應用程序設置我已將NODE_ENV
設置爲production
作爲值
我已經部署了主代碼後推我的代碼。但是當應用程序啓動時,它仍以我的控制檯登錄爲「開發模式」。我錯過了什麼在生產中啓動應用程序?我可以做到這一點本地只是不heroku
https://devcenter.heroku.com/articles/config-vars –
@Mark_M我已經完成了上述操作 –
我看不到你在哪裏調用類似'heroku config:set NPM_CONFIG_PRODUCTION = production' –