PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.03k stars 346 forks source link

[BUG] Internal exports of date-fns aren't included in builds with v3.2.0 #867

Open seaders opened 7 months ago

seaders commented 7 months ago

What happened?

We use an external library, date-fns https://github.com/date-fns/date-fns/issues/3670 and when we updated to version 3.2.0 of it, it stopped working, and broke our app in quite a few different places. I opened the above bug with them, and created a simple sample project to show the breakage, https://github.com/seaders/date-fns-example .

They are going to check to see if something's wrong on their side, but from their perspective, the plasmo build is building incorrectly - all works fine in a vanilla react project.

When the dev from date-fns had a look, this is where they specifically noticed, image

Again, they'll take a look at what they may be doing incorrectly to cause this their side, but their initial consideration is that it's a bug with plasmo.

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

popup.tsx:10 TypeError: Cannot read properties of undefined (reading 'p')
    at format.mjs:365:48
    at Array.map (<anonymous>)
    at format (format.mjs:362:42)
    at formatRelative (formatRelative.mjs:87:37)
    at asdf (popup.tsx:7:25)
    at IndexPopup (popup.tsx:18:3)
    at renderWithHooks (react-dom.development.js:16307:7)
    at mountIndeterminateComponent (react-dom.development.js:20075:13)
    at beginWork (react-dom.development.js:21590:10)
    at beginWork$1 (react-dom.development.js:27427:14)

(OPTIONAL) Contribution

Code of Conduct

bsommerer commented 5 months ago

I also experienced this error. Thanks for the nice investigation, downgrading to date-fns 3.1.0 also saved my Plasmo production build! In development mode somehow everything works as expected, even with date-fns 3.6.0.