从 git 回购(React JS,Nginx)中拉出后出现白屏死机

Whitescreen of death after pulling from git repo (ReactJS, Nginx)

每当我从我的主分支执行 git 拉取到我的服务器时,我所有的 React 文件似乎都消失了,屏幕变白了。

我找到的临时解决方法是:

  1. 删除浏览器 cookie、缓存和站点历史记录,然后关闭浏览器并重试。
  2. 删除node_modules,重新npm安装所有react依赖

一段时间后,该站点重新出现,一切正常,直到下一次拉取请求后,问题再次出现。

我在任何浏览器上使用的任何控制台都没有显示任何错误消息。 经过 2 个多星期的谷歌搜索,我似乎找不到与此问题相关的任何内容。

这是我的规格:

Ubuntu 16.04 服务器 框架:React 16.2.0 网页包 1.12 nginx 版本:nginx/1.10.3 (Ubuntu) git 版本 2.7.4

我的 webpack 设置(为了清楚起见,我用命令编译了我所有的反应文件):

node_modules/.bin/webpack --config webpack.local.config.js

(本地)

var path = require("path")
var webpack = require('webpack')
var BundleTracker = require('webpack-bundle-tracker')
var config = require('./webpack.base.config.js')

config.devtool = "#eval-source-map"

config.plugins = config.plugins.concat([
    new BundleTracker({
        filename: './webpack-stats-local.json'
    }),
])

config.module.loaders.push({
    test: /\.js[x]?$/,
    exclude: /node_modules/,
    loaders: ['react-hot-loader/webpack', 'babel'],
})

module.exports = config

(基础)

var path = require("path")
var webpack = require('webpack')

module.exports = {
    context: __dirname,

    entry: {
        App1: './path/to/App1/',
        App2: './path/to/App2/',
        // ...
        App10: './path/to/App10/',
        vendors: ['react'],
    },

    output: {
        path: path.resolve('./backend/static/bundles/local/'),
        filename: "[name]-[hash].js"
    },

    externals: {
        "gettext":"gettext",
        "django":"django",
        }, // add all vendor libs

    plugins: [
        new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
    ],

    module: {
        loaders: []
    },

    resolve: {
        modulesDirectories: ['node_modules', 'bower_components'],
        extensions: ['', '.js', '.jsx']
    },
}

任何帮助将不胜感激

我通过将 Webpack 更新到版本 4 + 更新我使用的依赖项同时删除我不使用的依赖项来解决这个问题。