我正在尝试设置我的vue.config.js文件,当我使用@vue/cli中的defineConfig方法时发现了这个问题。
TypeError: defineConfig不是一个函数
vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
devServer: {
port: 3001,
},
});
defineConfig是未定义的。我试图在cli-service文件夹中查找它,但是(假设)没有这样的方法。
我使用的是vue.js 3,纱线1.22.17,我的@vue/cli版本是4.5.15。是否可能defineConfig是用于@vue/cli版本5..
发布于 2022-06-17 18:56:47
defineConfig
宏由Vite使用,而不是由Vue CLI使用,vue cli的正确语法是:
module.exports = {
devServer: {
port: 3001,
},
};
https://stackoverflow.com/questions/72663598
复制相似问题