Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Webpack Dev Build/sockjs node/xxxxxxxxxxx/xhr\u streaming?t=XXXXXXXX被多次调用_Javascript_Node.js_Reactjs_Webpack_Webpack Dev Server - Fatal编程技术网

Javascript Webpack Dev Build/sockjs node/xxxxxxxxxxx/xhr\u streaming?t=XXXXXXXX被多次调用

Javascript Webpack Dev Build/sockjs node/xxxxxxxxxxx/xhr\u streaming?t=XXXXXXXX被多次调用,javascript,node.js,reactjs,webpack,webpack-dev-server,Javascript,Node.js,Reactjs,Webpack,Webpack Dev Server,开发模式的我的网页包配置文件 在开发模式下启动节点服务器时 多个请求(例如:)正在命中服务器 这是在开发模式下发生的,而不是在产品构建中 我猜这是因为热重新加载选项 const path = require('path'); const autoprefixer = require('autoprefixer'); const webpack = require('webpack'); const CaseSensitivePathsPlugin = require('case-sensitiv

开发模式的我的网页包配置文件 在开发模式下启动节点服务器时 多个请求(例如:)正在命中服务器 这是在开发模式下发生的,而不是在产品构建中

我猜这是因为热重新加载选项

const path = require('path');
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
const { ReactLoadablePlugin } = require('react-loadable/webpack');
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin');
const DashboardPlugin = require('webpack-dashboard/plugin');
const { getAppEnv } = require('./env');

const env = getAppEnv();
const { PUBLIC_URL = '' } = env.raw;
const resolvePath = relativePath => path.resolve(__dirname, relativePath);

module.exports = {
  mode: 'development',
  devtool: 'cheap-module-source-map',
  entry: [
    'webpack-hot-middleware/client?path=/__webpack_hmr&reload=true',
    resolvePath('../src/index.js')
  ],
  output: {
    path: resolvePath('../build'),
    filename: '[name].bundle.js',
    chunkFilename: '[name].chunk.js',
    publicPath: PUBLIC_URL + '/'
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        enforce: 'pre',
        use: [
          {
            options: {
              formatter: eslintFormatter
            },
            loader: 'eslint-loader'
          }
        ],
        include: resolvePath('../src')
      },
      {
        test: /\.(js|jsx)$/,
        include: resolvePath('../src'),
        loader: 'babel-loader',
        options: {
          cacheDirectory: true
        }
      },
      {
        test: /\.(eot|otf|ttf|woff|woff2)$/,
        use: 'file-loader'
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'svg-url-loader',
            options: {
              // Inline files smaller than 10 kB
              limit: 10 * 1024,
              noquotes: true
            }
          }
        ]
      },
      {
        test: /\.(jpg|png|gif)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              // Inline files smaller than 10 kB
              limit: 10 * 1024
            }
          },
          {
            loader: 'image-webpack-loader',
            options: {
              mozjpeg: {
                enabled: false
                // NOTE: mozjpeg is disabled as it causes errors in some Linux environments
                // Try enabling it in your environment by switching the config to:
                // enabled: true,
                // progressive: true,
              },
              gifsicle: {
                interlaced: false
              },
              optipng: {
                optimizationLevel: 7
              },
              pngquant: {
                quality: '65-90',
                speed: 4
              }
            }
          }
        ]
      },
      {
        test: /\.s?css$/,
        exclude: [resolvePath('../src/styles')],
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              // camelCase: true,
              // modules: true
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              ident: 'postcss',
              plugins: () => [
                require('postcss-flexbugs-fixes'),
                autoprefixer({
                  // browsers: ['last 2 versions', 'not ie < 11'],
                  flexbox: 'no-2009'
                })
              ]
            }
          },
          'sass-loader',
          'import-glob-loader'
        ]
      },
      {
        test: /\.s?css$/,
        include: [resolvePath('../src/styles')],
        use: [
          'style-loader',
          'css-loader',
          {
            loader: 'postcss-loader',
            options: {
              ident: 'postcss',
              plugins: () => [
                require('postcss-flexbugs-fixes'),
                autoprefixer({
                  // browsers: ['last 2 versions', 'not ie < 11'],
                  flexbox: 'no-2009'
                })
              ]
            }
          },
          'sass-loader',
          'import-glob-loader'
        ]
      }
    ]
  },
  plugins: [
    new webpack.DefinePlugin(env.forWebpackDefinePlugin),
    new webpack.HotModuleReplacementPlugin(),
    new CaseSensitivePathsPlugin(),
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    new LodashModuleReplacementPlugin(),
    new ErrorOverlayPlugin(),
    new DashboardPlugin(),
    new ReactLoadablePlugin({
      filename: 'build/react-loadable.json'
    })
  ],
  node: {
    dgram: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
};
const path=require('path');
const autoprefixer=require('autoprefixer');
const webpack=require('webpack');
const CaseSensitivePathsPlugin=require('case-sensitive-path-webpack-plugin');
const eslintFormatter=require('react-dev-utils/eslintFormatter');
const LodashModuleReplacementPlugin=require('lodash-webpack-plugin');
const{ReactLoadablePlugin}=require('react-loadable/webpack');
const ErrorOverlayPlugin=require('error-overlay-webpack-plugin');
const DashboardPlugin=require('webpack-dashboard/plugin');
const{getAppEnv}=require('./env');
const env=getAppEnv();
const{PUBLIC_URL=''}=env.raw;
const resolvePath=relativePath=>path.resolve(\uu dirname,relativePath);
module.exports={
模式:"发展",,
devtool:“廉价模块源映射”,
条目:[
“webpack热中间件/客户端?路径=/\uuuuuWebpack\uHMR&reload=true”,
resolvePath('../src/index.js')
],
输出:{
路径:resolvePath(“../build”),
文件名:'[name].bundle.js',
chunkFilename:'[name].chunk.js',
publicPath:PUBLIC_URL+'/'
},
模块:{
规则:[
{
测试:/\(js|jsx)$/,
强制执行:“预”,
使用:[
{
选项:{
格式化程序:eslintFormatter
},
加载程序:“eslint加载程序”
}
],
包括:resolvePath(“../src”)
},
{
测试:/\(js|jsx)$/,
包括:resolvePath('../src'),
加载器:“巴别塔加载器”,
选项:{
缓存目录:true
}
},
{
测试:/\(eot | otf | ttf | woff | woff2)$/,
使用:“文件加载器”
},
{
测试:/\.svg$/,,
使用:[
{
加载程序:“svg url加载程序”,
选项:{
//小于10 kB的内联文件
上限:10*1024,
没错
}
}
]
},
{
测试:/\(jpg | png | gif)$/,
使用:[
{
加载器:“url加载器”,
选项:{
//小于10 kB的内联文件
上限:10*1024
}
},
{
加载器:“图像网页包加载器”,
选项:{
mozjpeg:{
已启用:false
//注意:mozjpeg被禁用,因为它在某些Linux环境中会导致错误
//通过将配置切换到以下位置,尝试在您的环境中启用它:
//启用:对,
//进步:是的,
},
礼物:{
交错:假
},
optipng:{
优化级别:7
},
pngquant:{
质量:“65-90”,
速度:4
}
}
}
]
},
{
测试:/\.s?css$/,,
排除:[解析路径('../src/styles')],
使用:[
“样式加载器”,
{
加载器:“css加载器”,
选项:{
//camelCase:是的,
//模块:正确
}
},
{
加载器:“postss加载器”,
选项:{
标识:'邮政编码',
插件:()=>[
需要('PostSS-flexbugs-fixes'),
自动刷新器({
//浏览器:['last 2 versions','not ie<11'],
flexbox:“no-2009”
})
]
}
},
“sass loader”,
“导入全局加载程序”
]
},
{
测试:/\.s?css$/,,
包括:[resolvePath('../src/styles')],
使用:[
“样式加载器”,
“css加载程序”,
{
加载器:“postss加载器”,
选项:{
标识:'邮政编码',
插件:()=>[
需要('PostSS-flexbugs-fixes'),
自动刷新器({
//浏览器:['last 2 versions','not ie<11'],
flexbox:“no-2009”
})
]
}
},
“sass loader”,
“导入全局加载程序”
]
}
]
},
插件:[
新的webpack.DefinePlugin(env.forwebpack DefinePlugin),
新建webpack.HotModuleReplacementPlugin(),
新的区分大小写的PathSplugin(),
新的webpack.IgnorePlugin(/^\.\/locale$/,/moment$/),
新的LodashModuleReplacementPlugin(),
新的ErrorOverlayPlugin(),
新建DashboardPlugin(),
新的ReactLoadablePlugin({
文件名:“build/react loadable.json”
})
],
节点:{
dgram:'空',
财政司司长:‘空置’,
net:'空',
tls:'空'
}
};
截图。。。


您可能回答了自己的问题。@urbz我不知道您能帮我解决这个问题吗?嗯,您可能在生产中没有热重新加载功能,因为您在dev中有热重新加载功能,您可以尝试关闭它并查看它发出的请求数。另外,请检查最初从服务器请求数据的代码。您可能回答了自己的问题。@urbz我不知道您是否可以帮助我解决此问题。嗯,您可能在生产中没有热重新加载,而且由于您在dev中有热重新加载,您可以尝试关闭它并查看它发出的请求数。此外,请检查最初从服务器请求数据的代码。