PDA

View Full Version : issue to sharing componemt



happyboyhk
30 May 2018, 1:19 AM
hi all,

I would like to separate two projects. One is common project to implement common component to use. The second one is main project to use common component to develop.

I use npm link path:commonproject to connect common project to main project so that I can use the common component in main project.

However, I found the following issue:

ExtJSComponent.js:977 Uncaught TypeError: Cannot read property 'insert' of undefined
at Object.../../cmis-app-client-common/node_modules/@extjs/reactor/dist/ExtJSComponent.js._ReactComponentEnvironment2.default.replaceNodeWithMarkup (ExtJSComponent.js:977)
at ReactCompositeComponentWrapper._replaceNodeWithMarkup (ReactCompositeComponent.js:781)
at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:771)
at ReactCompositeComponentWrapper._performComponentUpdate (ReactCompositeComponent.js:721)
at ReactCompositeComponentWrapper.updateComponent (ReactCompositeComponent.js:642)
at ReactCompositeComponentWrapper.receiveComponent (ReactCompositeComponent.js:544)
at Object.receiveComponent (ReactReconciler.js:122)
at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:751)
at ReactCompositeComponentWrapper._performComponentUpdate (ReactCompositeComponent.js:721)
at ReactCompositeComponentWrapper.updateComponent (ReactCompositeComponent.js:642)

I found that if common and main project used <Container> …</Container>, the issue will be shown

May I have any advice to solve this issue?

luis.santos
26 Jul 2018, 1:48 PM
I have been trying to do something similar for a while. I started using npm successfully and I never saw an error like that but I am getting to a point where npm link is not enough since it may not be the best approach in a Continuous Integration environment or a Docker container.

Almost a year ago Mark Brocato shared an example on how to create libraries: https://github.com/markbrocato/ext-react-library-example