首页 > 解决方案 > Browserify 使用 require('fs-extra') 并在加载 bundle.js 时抛出 Uncaught TypeError: Object prototype may only be an Object or null: undefined

问题描述

此问题仅特定于 fs-extra 模块。当我尝试在 html 中加载 browserified bundle.js 时,会出现错误。

bundle.js:2483 Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.setPrototypeOf (<anonymous>)
    at bundle.js:2483
    at patch (bundle.js:2485)
    at patch (bundle.js:1949)
    at Object.<anonymous> (bundle.js:1941)
    at Object.<anonymous> (bundle.js:2220)
    at Object.31../clone.js (bundle.js:2220)
    at o (bundle.js:1)
    at bundle.js:1
    at Object.14../copy (bundle.js:803)

标签: javascriptnpmbrowserifyfs-extra

解决方案


推荐阅读