Code declaring __STAGE__ in webpack.dev.conf.js
new webpack.DefinePlugin({
'process.env': config.dev.env,
__STAGE__: "'dev'"
}),
The code quoted in reqData.js is as follows
req: function (p) {
const req_obj = getReqObj(p)
if (__STAGE__ === 'dev') {
// console.log(__STAGE__)
req_obj.apiName = p.apiName
return test(req_obj)
}
delete req_obj.apiName
return $ajax(req_obj)
},
The same code, why does our project code not report an error when npm run dev, and can print out this variable, but the project I wrote myself reports an error when sending a request with this configuration. Is it because of the version? The company uses version 1.0, and mine is version 2.0.
Just re-run the command npm run dev. What a trap!