Object prototype may only be an Object or null error on Webpack
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 349
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Description
by adding the following line:
const solc = require('solc');
in my App.js file, I get the error below when loading the page. I believe this could be caused by webpack 5, since polyfills are involved, but not sure how to fix it. I appreciate any help thanks.
```
bundle.js:8701 Uncaught TypeError: Object prototype may only be an Object or null: undefined
at Function.setPrototypeOf ()
at eval (polyfills.js:140)
at patch (polyfills.js:142)
at patch (graceful-fs.js:105)
at eval (graceful-fs.js:97)
at Object../node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js (bundle.js:3436)
at __webpack_require__ (bundle.js:8698)
at fn (bundle.js:8936)
at eval (index.internals.js:10)
at Object../node_modules/gulp-sourcemaps/src/init/index.internals.js (bundle.js:3488)
eval @ polyfills.js:140
patch @ polyfills.js:142
patch @ graceful-fs.js:105
eval @ graceful-fs.js:97
./node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js @ bundle.js:3436
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.internals.js:10
./node_modules/gulp-sourcemaps/src/init/index.internals.js @ bundle.js:3488
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:10
./node_modules/gulp-sourcemaps/src/init/index.js @ bundle.js:3499
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/gulp-sourcemaps/index.js @ bundle.js:3324
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:8
./node_modules/vinyl-fs/lib/src/index.js @ bundle.js:7078
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/vinyl-fs/index.js @ bundle.js:6902
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:25
./node_modules/module/dist/index.js @ bundle.js:4497
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/require-from-string/index.js @ bundle.js:5656
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ wrapper.js:3
./node_modules/solc/wrapper.js @ bundle.js:5955
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:1
./node_modules/solc/index.js @ bundle.js:5915
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ App.js:51
./src/App.js @ bundle.js:878
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:5
./src/index.js @ bundle.js:900
__webpack_require__ @ bundle.js:8698
(anonymous) @ bundle.js:9830
(anonymous) @ bundle.js:9833
Show 22 more frames
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the browser failure from App.js by requiring solc, then trace the reported path through solc/wrapper.js, module, require-from-string, vinyl-fs, gulp-sourcemaps, and graceful-fs. Compare the Webpack 5 polyfill behavior at polyfills.js:140 and determine a confirmed compatible usage or dependency fix; done means the page loads without the prototype error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript, webpack
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100