node.js - Based on dvajs, how can I get the current environment in the code?
天蓬老师
天蓬老师 2017-05-16 13:39:23
0
1
510

How can I get the current environment in the code? For example, when I develop, I want to simulate the results of user input...such as the results of scanning a QR code...

I read a few webpack configuration files and it said that node_env can be obtained. But no matter how I configure it, it has no effect...

if(ENV=='dev'){
console.log('开发环境');
}
else{
console.log('生产环境');
}

thank you all.

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
刘奇

webpack has a plug-in

new webpack.DefinePlugin({
            'ENV': '"production"'
        })
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template