Steps to reproduce
Trying to use react_component where a page has 2 pack tags loaded.
example .html.erb file
<div id='inside-comp'>
<%= javascript_pack_tag 'application' %>
<%= javascript_pack_tag 'outside' %>
<%= react_component("InsideComp", { greeting: "Hello" }, {prerender: false}) %>
</div>
Resulting error
1. fromRequireContextWithGlobalFallback.js:19 Error: Cannot find module './InsideComp'.
at webpackContextResolve (.*$:14)
at webpackContext (.*$:9)
at fromRequireContext.js:13
at Object.getConstructor (fromRequireContextWithGlobalFallback.js:13)
at Object.mountComponents (index.js:85)
at HTMLDocument.ReactRailsUJS.handleMount (index.js:132)
2. ReferenceError: InsideComp is not defined
at eval (eval at module.exports (fromGlobal.js:13), <anonymous>:1:1)
at module.exports (fromGlobal.js:13)
at Object.getConstructor (fromRequireContextWithGlobalFallback.js:17)
at Object.mountComponents (index.js:85)
at HTMLDocument.ReactRailsUJS.handleMount (index.js:132)
3. index.js:95 Uncaught Error: Cannot find component: 'InsideComp'. Make sure your component is available to render.
at Object.mountComponents (index.js:95)
at HTMLDocument.ReactRailsUJS.handleMount (index.js:132)
Expected behavior
Component loads and no console errors
Actual behavior
Component loads correctly but you still get 3 console errors.
System configuration
Sprockets or Webpacker version: 3.2
React-Rails version: 2.4.2
Rect_UJS version: 2.4.2
Rails version: 5.1.2
Ruby version: 2.4.2
- Sample repo: https://github.com/ratneshraval/react-rails-webpacker-test
- Repo readme tells you 3 commands to run
- Visit /insidecomp and /outsidecomp
- Check console log.
Steps to reproduce
Trying to use
react_componentwhere a page has 2 pack tags loaded.example .html.erb file
Resulting error
Expected behavior
Component loads and no console errors
Actual behavior
Component loads correctly but you still get 3 console errors.
System configuration
Sprockets or Webpacker version: 3.2
React-Rails version: 2.4.2
Rect_UJS version: 2.4.2
Rails version: 5.1.2
Ruby version: 2.4.2