小哥帮忙看一下,如何访问老师写在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