升级搜索接口时,遇到问题

来源:10-4 搜索页面suggest组件开发(1)

慕后端7393567

2019-04-18

var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')

// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
  baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
})

module.exports = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: '#cheap-module-eval-source-map',
  plugins: [
    new webpack.DefinePlugin({
      'process.env': config.dev.env
    }),
    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true
    }),
    new FriendlyErrorsPlugin()
  ]
})

老师,这是我的webpack.dev.conf.js文件,对比你升级搜索接口的issue的webpack.dev.conf.js文件差别好大。而且我的项目结构里没有prod.server.js这个文件。求解=。=
图片描述

写回答

1回答

ustbhuangyi

2019-04-18

prod.server.js 是后面加的,你只要在 webpack.dev.conf.js 配置路由接口就可以了,参考
https://github.com/ustbhuangyi/vue-music/commit/be096f36922598aa877109c82f238471131254d0

0
2
ustbhuangyi
回复
慕后端7393567
这个是 vue cli 2.9.x 的配置,你可以改成用 devServer 啊,不然的话,你之前的 api 接口怎么搞的,你还怎么搞呗?
2019-04-18
共2条回复

Vue2.0高级应用教学实战,开发企业级移动端音乐Web App

Vue.js高级知识应用大集合,实战企业级APP,教你搞定组件化开发。

5432 学习 · 3804 问题

查看课程