我有一个config.js
文件:
const serviceModule = {
AxiosConfig:{
baseURL: 'http://10.10.10.105:8001/',
withCredentials: true,
headers: {
"Content-Type": "application/json;charset=utf-8"
}
}
}
let ApiSetting = {...serviceModule };
export default ApiSetting
但是在npm run dev
的时候会报错:
ERROR in ./src/api/config.js
Module build failed: SyntaxError: Unexpected token (28:18)
26 |
27 |
> 28 | let ApiSetting = {...serviceModule };
| ^
29 |
30 | export default ApiSetting
31 |
@ ./src/api/http.js 6:0-34
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main
请问这是哪里的问题呢?
...是ES2018 里面的特性,需要配置下babel的环境。
babelrc配置可以参照如下所示