-
Notifications
You must be signed in to change notification settings - Fork 0
Consider how govuk-react-jsx is packaged up as a UMD. Switch to ESM? Both? #148
Comments
Some more details about the problem we had. We used
One of our components uses
In the SSR, webpack was treating
I didn't dig in deep enough to figure out why the client side config did intercept the require and use the In the end our workaround was to have SSR not treat I think ESM vs UMD might be a distraction here. In writing this up I'm still not satisfied I fully understand why the externals hack fixed this for us, but it was a case of moving on with the rest of the project. |
Ah ok that's interesting. And gnarly sounding 😬 Similar discussions went on in #107 - I suspect if you did look at both the webpack configs you would find that one was configured with a loader to handle the image imports and the other wasn't. Totally appreciate you've got a solution now, and you've largely moved on! But if you do think anything needs changing at my end please let me know and we can thrash it out. Although as you no doubt appreciate it's quite hard to support all of the exotic ways people consume this package! Fun, but mind bending... |
Yeah it was a bit hairy - actually I think I said mind bending a few times too :) Pretty sure I found that ticket back in Feb, along with a few ones about similar NextJS problems. There is an image loader in the SSR config; the trick was convincing webpack to process I spent some time examining other React component libraries. I didn't find one that one had images, but where they had CSS(from css/less/sass), in the distributed assets they had the That's fine for CSS, but a pain for inline |
Consider how govuk-react-jsx is packaged up as a UMD. Switch to ESM? Both?
Need to do some research and look at what the current best way is to do this.
See GSS-Cogs/dd-cms#49 where they experienced some issues with the current packaging.
The text was updated successfully, but these errors were encountered: