question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

findDOMNode brings whole react-dom to the chunk

See original GitHub issue

say you have code like this

import Loadable from "react-loadable";
const PhoneAsync = Loadable({
  loader: () => import("react-phone-number-input"),
  loading: () => <span>Loading the phone number</span>
});

this will produce a separate chunk (I’m talking about webpack2+, like c-r-a setup). This chunk will look like this

screen shot 2018-01-09 at 11 02 30

Same issue in https://github.com/catamphetamine/input-format

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stereoboostercommented, Jan 9, 2018

these are very trivial and simple things

I suppose you have extensive experience in implementing tree shaking and bundlers. I will not bother you with my comments anymore.

1reaction
stereoboostercommented, Jan 9, 2018

How are you going to use React in a web browser without react-dom?

Yes I will use it in my application. I’m saying component should not depend on it.

The only question is: why did your bundler include it the second time in this separate chunk because it must be in your main chunk already.

Because webpack cannot do magic. You asked for it it gets it for you. Tree shaking is very limited - you can use https://www.npmjs.com/package/eslint-plugin-tree-shaking to see what won’t be tree shaken.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactDOM – React
findDOMNode is an escape hatch used to access the underlying DOM node. In most cases, use of this escape hatch is discouraged because...
Read more >
ReactDOM.render is no longer supported in React 18 - Stack ...
I get this error every time I create a new React app: Warning: ReactDOM.render is no ...
Read more >
CSSTransition using findDOMNode which is deprecated in ...
A warning regarding the deprecation of findDOMNode is shown when using the SwitchTransition & CSSTransition in Strict mode (React v16.13.1).
Read more >
Managing DOM components with ReactDOM - LogRocket Blog
Learn to expertly manage DOM components in a React app, including a deep dive into each ReactDOM method, with this comprehensive tutorial.
Read more >
What is StrictMode in React? - KnowledgeHut
The fact that it gives visual feedback (warning/error messages) whenever the ... import ReactDOM from 'react-dom'; import React from 'react; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found