Guest User

Untitled

a guest
Mar 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. *BLUF*
  2.  
  3. When my application was bundled with Webpack 1 everything worked
  4. without error. However, when I upgraded to Webpack 4 the rc-tooltip
  5. component used in another package throws a runtime error of
  6.  
  7. > warning.js:33 Warning: React.createElement: type is invalid
  8. > -- expected a string (for built-in components) or a class/function
  9. > (for composite components) but got: object.
  10.  
  11. *Dependencies*
  12.  
  13. ```
  14. - ProjectX (my web application)
  15. - ProjectY (my custom package)
  16. - rc-tooltip
  17. ```
  18.  
  19. The webpack configuration for ProjectX is shown below.
  20.  
  21. *Details*
  22.  
  23. Under both versions, creation of the tooltip appears to be the same.
  24.  
  25. ```
  26. React.createElement(Tooltip, my-props, my-childern):
  27. ```
  28.  
  29. However, inspected what Tooltip actually is under Webpack 1 v Webpack 4
  30. and found a key difference.
  31.  
  32. Under Webpack 1, on the console
  33.  
  34. ```
  35. > Tooltip
  36. ƒ Tooltip() {
  37. var _ref;
  38. var _temp, _this, _ret;
  39. (0, _classCallCheck3['default'])(this, Tooltip);
  40. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _…
  41. ```
  42.  
  43. Under Webpack 4, on the console
  44.  
  45. ```
  46. > Tooltip
  47. {default: ƒ, __esModule: true}default: ƒ Tooltip()__esModule: true__proto__: Object
  48. ```
  49.  
  50. It appears that under Webpack 4 I am not receiving the properly
  51. exported class. In fact, on the console I can create a new React
  52. element without error via
  53.  
  54. ```
  55. > React.createElement(Tooltip.default, my-props, my-childern):
  56. ```
  57.  
  58. Why would Webpack 4 alter how a package is expressed in my application?
  59. Is this a configuration issue, what am I missing?
Add Comment
Please, Sign In to add comment