@verifiedinc-public/shared-ui-elements 0.11.7-beta.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,3 +29,44 @@ This project utilizes alias only for the storybook implementation, the modules t
29
29
  ## Adding dependencies
30
30
 
31
31
  Ensure that new dependencies are added to both devDependencies and peerDependencies if required in the client's project.
32
+
33
+ ## Installing in Your Client Session
34
+
35
+ When installing the `@verifiedinc/shared-ui-elements` package, you have access to different export paths optimized for specific use cases.
36
+
37
+ ### Default ESM Export (Recommended)
38
+
39
+ The package’s default export path `'./'` uses ECMAScript modules (ESM), providing an optimized build for modern JavaScript environments. This approach is recommended for most applications:
40
+
41
+ ```bash
42
+ npm install @verifiedinc/shared-ui-elements
43
+ ```
44
+
45
+ ```typescript
46
+ import { SomeComponent } from '@verifiedinc/shared-ui-elements';
47
+ ```
48
+
49
+ This setup is efficient and works seamlessly with frameworks like Next.js, Vite, and other ESM-compatible environments.
50
+
51
+ ### Using with Remix
52
+
53
+ Some frontend frameworks, such as Remix, have partial compatibility with ESM-only packages. To address this, the package also exposes the source files directly. This approach ensures that the Remix transpiler can properly bundle the package.
54
+
55
+ To utilize the source files in Remix, reference them directly in your import statements and adjust your `remix.config.js` as follows:
56
+
57
+ ```typescript
58
+ import { SomeComponent } from '@verifiedinc/shared-ui-elements/src';
59
+ ```
60
+
61
+ ```js
62
+ // remix.config.js
63
+ export default {
64
+ serverDependenciesToBundle: [/@verifiedinc\/shared-ui-elements/],
65
+ };
66
+ ```
67
+
68
+ ### Why Two Exports?
69
+
70
+ The default `'./'` export is optimized for environments that support ESM, providing better performance and tree-shaking. However, by also exposing the raw source files, we ensure compatibility with tools like Remix, where ESM-only packages might not work seamlessly without additional configuration.
71
+
72
+ Choose the export method that best suits your project setup.