老师,npm run serve后报错,说path.json is not function
来源:3-1 目录结构 & header 组件

Brilliance_pan
2019-03-09
const path = require(‘path’)
const appData = require(’./data.json’)
const seller = appData.seller
const goods = appData.goods
const ratings = appData.ratings
function resolve (dir) {
return path.json(__dirname, dir)
}
module.exports = {
css: {
loaderOptions: {
stylus: {
‘resolve url’: true,
‘import’: [
’./src/theme’
]
}
}
},
pluginOptions: {
‘cube-ui’: {
postCompile: true,
theme: true
}
},
devServer: {
before (app) {
app.get(’/api/seller’, function (req, res) {
res.json({
errno: 0,
data: seller
})
})
app.get(’/api/goods’, function (req, res) {
res.json({
errno: 0,
data: goods
})
})
app.get(’/api/ratings’, function (req, res) {
res.json({
errno: 0,
data: ratings
})
})
}
},
chainWebpack(config) {
config.resolve.alias
.set(‘components’, resolve(‘src/components’))
.set(‘common’, resolve(‘src/common’))
}
}
4回答
-
你拼写错了012019-03-10 -
ustbhuangyi
2019-03-10
你贴一下你的 vue.config.js 里的代码
012019-03-10 -
Brilliance_pan
提问者
2019-03-10
是的,我的vue-cli是3.x以上的版本,前面的课程跟着做没什么问题,到这一节就出现这个情况
00 -
ustbhuangyi
2019-03-09
你是通过 vue-cli 3.0 初始化项目的吗
012019-03-10
相似问题