Hi, not sure if this is an issue with preact-compat, or I missed a critical detail somewhere, but my assumption is I could use React API hand to hand with Preact and everything would be smooth as butter. However, when trying to use react-grid-layout it appears when it attempts to call React.Children.only it returns a object which is fine, but for some reason, instead of keeping the .props attribute it renames it to .attributes in the response.
let child = React.Children.only(this.props.children);
What strikes me as very odd is that it ONLY happens in production builds. Debug builds give me the proper VNode, with .props attached to the object and everything is fine. For whatever reason Webpack4 or preact-compat is removing a key element here in production builds.
EDIT 2: After some more digging around, seems like everything works perfectly fine in Webpack3 ... So did I miss something perhaps when configuring with Webpack4? -- I followed the preact-boilerplate code as close as possiable w/ the latest iteration with Webpack 4. So for whatever reason, Webpack 4 doesn't like mixing React/Preact code, and decides to strip things out a little too much. Anyone can confirm? -- Looks like it will be a lot longer before I can safely use Webpack 4 without running into constant headaches. :man_shrugging:
Hi, not sure if this is an issue with preact-compat, or I missed a critical detail somewhere, but my assumption is I could use React API hand to hand with Preact and everything would be smooth as butter. However, when trying to use react-grid-layout it appears when it attempts to call React.Children.only it returns a object which is fine, but for some reason, instead of keeping the
.props
attribute it renames it to.attributes
in the response.What strikes me as very odd is that it ONLY happens in production builds. Debug builds give me the proper VNode, with
.props
attached to the object and everything is fine. For whatever reason Webpack4 or preact-compat is removing a key element here in production builds.My resource files:
Webpack Config
Babelrc
package.json (I removed unnecessary stuff)
EDIT: I've also included a test repo that repoduces this problem. https://github.com/ajm113/preact-grid-layout-test
EDIT 2: After some more digging around, seems like everything works perfectly fine in Webpack3 ... So did I miss something perhaps when configuring with Webpack4? -- I followed the preact-boilerplate code as close as possiable w/ the latest iteration with Webpack 4. So for whatever reason, Webpack 4 doesn't like mixing React/Preact code, and decides to strip things out a little too much. Anyone can confirm? -- Looks like it will be a lot longer before I can safely use Webpack 4 without running into constant headaches. :man_shrugging: