TypeError Super expression must either be null or a function, not und

問題:

TypeError: Super expression must either be null or a function, not undefinednode

分析:

這個問題遇到過兩次了,一次在企業版,還有一次在公安版裏邊react

解決:

企業版

企業版的時候,是由於使用webpack的默認壓縮出現問題,多是webpack4默認壓縮有bug,而後換成了UglifyJsPlugin來進行壓縮,解決webpack

minimizer: [
          new UglifyJsPlugin({
            test: [/\.(js|jsx)$/],
            exclude: [/node_modules/, /src\/components\/vendor/],
            cache: "./.cache",
            parallel: true,
            sourceMap: true,
            uglifyOptions: {
              warnings: false,
              compress: {
                inline: 1,
                keep_fnames: true
              },
              mangle: {
                keep_fnames: true
              }
            }
          })
        ],
複製代碼

公安版

此次解決比較曲折,沒有找到更好的辦法,只能一點點的排查,縮小範圍,最後發現是引入的一個庫anzi-ui裏邊的一個組件致使的。 組件裏邊使用了react hooks,來做爲組件,web

function alert() {}
複製代碼

最後沒有導出組件,而是導出的函數。express

相關文章
相關標籤/搜索