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' –