老师,npm run practice 后是静态文件效果
来源:3-2 Vue实例

一飞同学
2018-05-29
好像记得老师讲过,是个什么配置的问题,想不起来了
写回答
2回答
-
historyApiFallback
082018-09-05 -
vcfriend
2018-08-18
小哥帮忙看一下,如何访问老师写在practice目录中的示例代码呀.
咋弄的呀,修改文件 webpack.config.practice.js 代码如下还是不行啊
const devServer = { port: 8080, host: '0.0.0.0', overlay: { errors: true }, hot: true, historyApiFallback: { index: '/public/index.html' } }
webpack.config.base配置如下
const path = require('path') const createVueLoaderOptions = require('./vue-loader.config') const isDev = process.env.NODE_ENV === 'development' const config = { target: 'web', entry: path.join(__dirname, '../practice/index.js'), output: { path: path.join(__dirname, '../public'), filename: 'bundle.[hash:8].js', // 问题解决啦,修改这里的端口号为8080跟practice.js配置的端口一样就可以了 publicPath: 'http://127.0.0.1:8000/public/' }, module: { rules: [ { test: /\.(vue|js|jsx)$/, loader: 'eslint-loader', exclude: /node_modules/, enforce: 'pre' }, { test: /\.vue$/, loader: 'vue-loader', options: createVueLoaderOptions(isDev) }, { test: /\.jsx$/, loader: 'babel-loader' }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.(gif|jpg|jpeg|png|svg)$/, use: [ { loader: 'url-loader', options: { limit: 1024, name: 'resources/[path][name].[hash:8].[ext]' } } ] } ] } } module.exports = config
public是文件夹吗,这是什么路径,为什么访问不了,控制台报如下错误
GET http://127.0.0.1:8000/public/bundle.e5484162.js net::ERR_CONNECTION_REFUSED
122018-08-18
相似问题