我很久以前就开始使用webpack了。一切都很完美,React热负荷效果很好。但是有一个这个与webpack开发服务器,我无法理解。当我使用我的webapp向/ app / info发出无休止的请求时。它回来了404。
这是什么?我怎么能把它关掉?这是登录控制台:
这是我的配置(它几乎是React热负载的通用配置):
const webpack = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
module.exports = {
entry: [
'webpack-dev-server/client',
'bootstrap-loader',
'./src/app.js',
],
output: {
path: path.join(__dirname, '..', 'resources', 'static', 'app'),
filename: 'app.js',
publicPath: '/app',
},
devServer: {
headers:
{
'Access-Control-Allow-Origin': 'http://localhost:10000',
'Access-Control-Allow-Credentials': 'true',
},
},
// devtool: '#source-map',
resolve: { extensions: ['', '.js'] },
plugins: [
new webpack.NoErrorsPlugin(),
],
module: {
loaders: [
{
test: /\.(js)$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel-loader?presets[]=es2015,' +
'presets[]=react,' +
'presets[]=stage-0,' +
'plugins[]=' + path.join(__dirname, 'babelRelayPlugin') + ',' +
'plugins[]=transform-runtime,' +
'plugins[]=transform-object-rest-spread'],
},
{ test: /\.css$/, loaders: ['style', 'css', 'postcss'] },
{ test: /\.scss$/, loaders: ['style', 'css', 'postcss', 'sass'] },
{
test: /\.(woff2?(\?v=[0-9]\.[0-9]\.[0-9])?|png|jpg)$/,
loader: 'url?limit=25000',
},
{
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
loader: 'file',
},
// Use one of these to serve jQuery for Bootstrap scripts:
// Bootstrap 4
{ test: /bootstrap\/dist\/js\/umd\//, loader: 'imports?jQuery=jquery' },
// Bootstrap 3
{ test: /bootstrap-sass\/assets\/javascripts\//, loader: 'imports?jQuery=jquery' },
],
},
postcss: [autoprefixer],
};
答案 0 :(得分:0)
此评论解决了我的问题https://github.com/webpack/webpack-dev-server/issues/326#issuecomment-171344167。我将'webpack-dev-server/client',
更改为'webpack-dev-server/client?http://localhost:8080/',