knocklabs / javascript

Official JavaScript packages for interacting with Knock
https://knock.app/
MIT License
11 stars 2 forks source link

fix: update remove-css-imports regex to be more precise #14

Closed connorlindsey closed 6 months ago

connorlindsey commented 6 months ago

The remove-css-imports regex had a bug which was deleting part of the output React components in the CJS build. The regex was matching everything from the first require( up to .css.js)"; instead of just matching a single css require.

The previous regex matched all characters (.+) and the new one matches everything but parentheses ([^()]+) so it doesn't match non-css requires.

In practice, this removed the require calls for jsx in the button components. It only affected the button components because they import styles.

Found the issue when using the package with the knock node example which uses Blitz. Tested against it and the components work 🎉

Unrelated: adds in some style changes to the archive button to stay synced with @knocklabs/react-notification-feed

linear[bot] commented 6 months ago
KNO-4993 Fix jsx-runtime import

Affects older Blitz version

changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 74cc7bb4a385561c61bebe597ceb00d5d731743d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages | Name | Type | | --------------------- | ----- | | @knocklabs/react-core | Patch | | @knocklabs/react | Patch | | nextjs-example | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR