问题已经解决了,但基本上,我建立了一个没有webpack的新vue
应用。当我尝试做时:
handleSubmit() {
axios
.post(`${process.env.VUE_APP_API_URL}`)
.then(response => (this.info = response));
this.$router.push({ name: "ConversationsList" });
}
它是未定义的。在我的.env
文件中,我有:
VUE_APP_API_URL=http://localhost:3000
我现在该怎么办?
答案 0 :(得分:0)
轻松修复。创建了一个名为vue.config.js
的文件:
const webpack = require('webpack')
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
]
}
}