Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.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 导致包丢失的网页包争用条件_Javascript_Reactjs_Webpack - Fatal编程技术网

Javascript 导致包丢失的网页包争用条件

Javascript 导致包丢失的网页包争用条件,javascript,reactjs,webpack,Javascript,Reactjs,Webpack,我的生产服务器出现以下问题。捆绑包从tiem生成并加载到times。每次刷新页面时,我都会得到不同的结果,有三种可能的结果: 获取https://*****/static/bundles/auth-0e4207bad21fde30f817.js 404(未找到) 每件东西都很重 net::ERR_中止错误 以下是我的production.config.js网页: var config = require('./webpack.config.js'); var BundleTracker = re

我的生产服务器出现以下问题。捆绑包从tiem生成并加载到times。每次刷新页面时,我都会得到不同的结果,有三种可能的结果:

  • 获取https://*****/static/bundles/auth-0e4207bad21fde30f817.js 404(未找到)
  • 每件东西都很重
  • net::ERR_中止错误
  • 以下是我的production.config.js网页:

    var config = require('./webpack.config.js');
    var BundleTracker = require('webpack-bundle-tracker');
    var webpack = require('webpack');
    
    config.output.publicPath = '/static/bundles/';
    
    config.plugins = [
        new BundleTracker({filename: './webpack-stats-prod.json'}),
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery'
        })
    ];
    
    config.entry = {
        main: './static/js/main',
        auth: './static/js/auth',
        pathway: './static/js/pathway',
        report: './static/js/report',
        upload: './static/js/upload'
    };
    
    module.exports = config;
    
    和我的config.js:

    var path = require('path')
    var webpack = require('webpack')
    var BundleTracker = require('webpack-bundle-tracker')
    
    module.exports = {
        context: __dirname,
        entry: [
            'webpack-dev-server/client?http://localhost:3000',
            'webpack/hot/only-dev-server',
            './static/js/main',
            './static/js/auth',
            './static/js/pathway',
            './static/js/report',
            './static/js/upload'
        ],
        entry: {
            main: './static/js/main',
            auth: './static/js/auth',
            pathway: './static/js/pathway',
            report: './static/js/report',
            upload: './static/js/upload'
        },
        output: {
            path: path.resolve('./static/bundles/'),
            filename: '[name]-[hash].js',
            publicPath: 'http://localhost:3000/static/bundles/'
        },
        plugins: [
            new BundleTracker({filename: './webpack-stats.json'}),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoEmitOnErrorsPlugin(),
            new webpack.ProvidePlugin({
                $: 'jquery',
                jQuery: 'jquery',
                'window.jQuery': 'jquery'
            })
        ],
        module: {
            loaders: [
                {
                    test: /\.jsx?$/,
                    loader: 'babel-loader',
                    options: {
                        presets: ['react']
                    }
                },
                {
                    test: /\.css$/,
                    loader: 'style-loader!css-loader'
                },
                {
                    test: /\.png$/,
                    loader: "url-loader?limit=100000"
                },
                {
                    test: /\.(jpg|gif)$/,
                    loader: "file-loader"
                },
                {
                    test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
                    loader: 'url-loader?limit=10000&mimetype=application/font-woff'
                },
                {
                    test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
                    loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
                },
                {
                    test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
                    loader: 'file-loader'
                },
                {
                    test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
                    loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
                }
            ]
        },
        resolve: {
            extensions: ['.js', '.jsx', '.css']
        }
    }
    
    有没有办法解决这个竞赛条件