Using b.require with react and react-dom results in an error
See original GitHub issue> browserify -r react -r react-dom -p tinyify
/.../node_modules/tinyify/node_modules/common-shakeify/index.js:222
return row[kDuplicates] || []
^
TypeError: Cannot read property 'Symbol(duplicates)' of undefined
at getDuplicates (/.../node_modules/tinyify/node_modules/common-shakeify/index.js:222:13)
at analyzer.modules.forEach (/.../node_modules/tinyify/node_modules/common-shakeify/index.js:121:21)
at Map.forEach (<anonymous>)
at DestroyableTransform.onend [as _flush] (/.../node_modules/tinyify/node_modules/common-shakeify/index.js:118:22)
at DestroyableTransform.prefinish (/.../node_modules/readable-stream/lib/_stream_transform.js:138:10)
at emitNone (events.js:106:13)
at DestroyableTransform.emit (events.js:208:7)
at prefinish (/.../node_modules/readable-stream/lib/_stream_writable.js:619:14)
at finishMaybe (/.../node_modules/readable-stream/lib/_stream_writable.js:627:5)
at endWritable (/.../node_modules/readable-stream/lib/_stream_writable.js:638:3)
It appears to only happen when I use them both; if I -r
them separately then it works fine. I tried it with some simpler packages such as once
and xtend
together and that appeared to work just fine.
The package.json:
{
"private": true,
"scripts": {
"test": "browserify -r react -r react-dom -p tinyify"
},
"dependencies": {
"react": "16.6.3",
"react-dom": "16.6.3"
},
"devDependencies": {
"browserify": "16.2.3",
"tinyify": "2.4.3"
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot resolve module 'react-dom' - Stack Overflow
Issue is react-dom is not installed, when you hit npm -v react-dom , it gives you the version of npm not react-dom version,...
Read more >Error Handling in React 16 – React Blog
Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
Read more >Error Boundaries - React
A class component becomes an error boundary if it defines either (or both) of the lifecycle methods static getDerivedStateFromError() or componentDidCatch() .
Read more >Refs and the DOM - React
Refs provide a way to access DOM nodes or React elements created in the render method. In the typical React dataflow, props are...
Read more >ReactDOM – React
If you use ES5 with npm, you can write: var ReactDOM = require('react-dom');. The react-dom package also provides modules specific to client and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t believe it is. I have an API example that uses common-shakeify 0.5.2 that results in a similar error:
I should add the when using
-r/b.require
, the top-levelrow.file
is equal to the module name and not its actual file path. Doing some historical search through history showed that this was not always the case.