Invalid options in vue.config.js: "resolve" is not allowed Process finished with exit code 1
时间: 2023-11-08 10:59:31 浏览: 89
在vue.config.js文件中,"resolve"选项不被允许。解决这个问题的方法是将"resolve"选项改为"chainWebpack",并在其下面配置别名。具体代码如下:
```javascript
module.exports = {
chainWebpack: (config) => {
// 配置别名
config.resolve.alias
.set('@', resolve('src'))
}
}
```
相关问题
Invalid options in vue.config.js: "resolve" is not allowed
这个错误提示说明在你的 `vue.config.js` 文件中使用了不允许的选项 `resolve`。这可能是因为你使用了一个旧版本的 Vue CLI 或者是你的配置文件有语法错误。
在新版的 Vue CLI 中,`resolve` 选项已经被移除了。如果你想配置模块解析规则,可以使用 `configureWebpack` 选项:
```js
module.exports = {
configureWebpack: {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.resolve(__dirname, 'src')
}
}
}
}
```
如果你使用的是旧版本的 Vue CLI,你可以尝试把 `resolve` 选项放在 `chainWebpack` 中:
```js
module.exports = {
chainWebpack: config => {
config.resolve.extensions
.add('.js')
.add('.vue')
.add('.json')
config.resolve.alias
.set('@', path.resolve(__dirname, 'src'))
}
}
```
如果你的配置文件中没有使用 `resolve` 选项,那么你需要检查一下该文件的语法是否正确,尤其是括号、引号等标点符号是否匹配。
Invalid options in vue.config.js: "devSever" is not allowed
The error message "Invalid options in vue.config.js: 'devSever' is not allowed" indicates that there is a typo in your Vue configuration file.
The correct option is "devServer" (with a capital S), not "devSever". So you need to update your configuration file to fix the typo.
Here's an example of a valid configuration file with the correct option:
```
module.exports = {
devServer: {
// Your dev server options here
}
}
```
Make sure to double-check your configuration file for any other typos or syntax errors as well.