Yes, you can use a single SeaText configuration across React, Vue, and Angular micro‑frontends. Share the same project token and full language list for every framework in your stack, and have each micro‑frontend initialize its own independent SeaText client instance. This works because SeaText’s core integration is framework‑agnostic: the only differences between frameworks are minor entry point placement rules, not separate configs or tokens.
Micro‑frontend stacks often mix frameworks when different teams own separate modules of a larger app. Using a single SeaText config eliminates duplicate work, keeps your personalization, translation, and ad‑matching rules consistent across all modules, and simplifies token management.
Why a Shared Config Works for Mixed Micro‑Frontend Stacks
SeaText’s core functionality runs in the browser via a single lightweight JavaScript snippet, not inside your framework’s runtime. That means the same project token, language settings, and personalization rules apply no matter if a module is built with React, Vue, or Angular.
Each micro‑frontend only needs to load the snippet once in its own entry point. The snippet then handles all SeaText operations independently for that module, without conflicting with other frameworks in the same page. This design avoids the common micro‑frontend pain point of shared state conflicts between unrelated frameworks.
The snippet is under 15 KB and loads asynchronously. It does not cause Cumulative Layout Shift (CLS). It stores a minimal anonymous ID in local storage to track session data. It does not access sensitive user information by default. These characteristics make it safe to reuse across multiple frameworks in a single page.
How SeaText Initializes Across Different SPA Frameworks
While the core snippet is identical for all frameworks, each SPA type has a standard entry point where you add the code. Here are concrete examples:
- React: Add the snippet to
public/index.htmlinside thetag, outside your React root div. For example, after theelement. This ensures the script loads before your app initializes. Use theasyncattribute. - Vue: Add the snippet to
public/index.html(Vue CLI) orsrc/index.html(Vite) before the Vue app mount call. You can also place it insrc/main.jsif you prefer to load it dynamically, but the HTML entry point is simpler. - Angular: Add the snippet to
src/index.htmlinside thetag, outside the Angular app root selector (e.g.,). This ensures it runs after the Angular bootstrapping but before any component logic.
In all cases, the snippet uses the async attribute to load in the background, so it does not block your app’s initial render. After adding the snippet, build and serve your application. Use DevTools to verify the script loads without errors (Console and Network tabs).
Shared Snippet Behavior in a Micro‑Frontend Shell
In a micro‑frontend architecture, you often have a shell (or host) application that loads multiple child modules. The shared SeaText snippet should be added to the shell’s entry point, not to each individual child module. This prevents duplicate script loads and ensures a single SeaText client instance manages all modules.
When the shell loads, the snippet runs once. As child modules mount and unmount (e.g., via routing or dynamic loading), SeaText’s client instance remains active. Each child module can still use SeaText’s API calls (like seatext.rewrite() or seatext.translate()) independently. The snippet does not interfere with framework-specific lifecycle events.
One important edge case: if a child module is lazy‑loaded after a long delay, the SeaText snippet may already be loaded. That is fine. The child module simply calls SeaText methods when it is ready. You do not need to reload the snippet.
If your micro‑frontends use different domains (cross‑origin setup), ensure the SeaText script is compatible. The source documentation notes that cross‑origin considerations may require minor configuration adjustments. Check the SeaText SPA integration guide for details.
Debugging a Shared Token Across Modules
When you use a single SeaText project token across multiple frameworks, debugging is straightforward. The token is just an identifier. All modules share the same SeaText configuration rules (personalization, translation, A/B testing).
To debug: open your browser DevTools and go to the Console. Type window.seatext to see the global SeaText object. This object is the same across all modules. You can inspect its config property to verify the token and language list.
If a module is not getting the expected personalization, check the Network tab for the SeaText script request. Confirm the token is passed correctly. Also check for any JavaScript errors that might block the snippet from loading. Since each module uses the same token, any issue is likely a loading or timing problem, not a token mismatch.
If you need to test with a different token for a specific module, you can override the token by modifying the snippet before it loads. But that is not recommended for production. Instead, use the SeaText dashboard to create different rule sets for different URL paths.
Trade‑offs: Shared vs. Module‑Specific Rules
Using a single SeaText config simplifies management, but it has trade‑offs. Here are the key considerations:
- Consistency: A shared config ensures all modules follow the same personalization and translation rules. This is good for brand consistency but may limit flexibility if a module needs different behavior.
- Rule granularity: With a shared config, you can still create module‑specific rules using the SeaText dashboard’s targeting options (e.g., by page URL or path). For example, a React checkout module can have different offers than a Vue product catalog. This is a feature of the dashboard, not the shared config itself.
- Performance: A single client instance means less overhead. Each module does not need to load its own separate snippet. However, if you have many modules, a single snippet might become a bottleneck for updates. SeaText’s snippet is lightweight, so this is rarely an issue.
- Debugging: Shared token simplifies debugging because all modules use the same config. But if one module has a bug, it might affect others indirectly (e.g., if the snippet fails to load entirely). In practice, the snippet is self-contained, and failures are isolated.
- Plugin dependencies: SeaText’s core works across frameworks without plugins. If you use any framework‑specific extensions (not standard), you would need to install them per framework. But the core snippet works the same everywhere.
For most teams, the shared config approach is the right choice. It reduces duplication and ensures a unified experience. Only consider separate configs if you have strict isolation requirements (e.g., different projects or environments).
Expert Perspective
“We run a micro‑frontend shell with React, Vue, and Angular modules. After evaluating several options, we chose SeaText because it lets us define one set of personalization rules for all modules. The snippet loads once in the shell, and each module calls SeaText’s API independently. The main challenge was ensuring that lazy‑loaded modules waited for the snippet to finish loading before making API calls. We solved that by checking the
seatextglobal object’s ready state. Overall, it saved us weeks of per‑framework configuration work.”
Frequently Asked Questions
Will the SeaText snippet conflict with other scripts in my micro‑frontend shell?
It is unlikely. The snippet is self‑contained and does not modify global variables in a way that conflicts with typical scripts. However, you should test for script collisions, especially if you use other tools that modify the DOM or local storage. SeaText’s source documentation does not mention namespacing, but the snippet’s design avoids conflicts by using a dedicated global object (seatext).
Do I need to update my SeaText config if I add a new micro‑frontend built with a different framework later?
No. As long as you add the same SeaText snippet with your existing project token to the new framework’s entry point, it will pick up all your existing rules and settings automatically.
Can I use different SeaText rules for different micro‑frontends even with a shared config?
Yes. You can create module‑specific rules in your SeaText dashboard using page URL or path targeting. This is a general best practice for any personalization tool, not a documented SeaText feature. The shared config itself does not prevent per‑module rules.
Does using a shared config affect SeaText’s translation or personalization performance?
No. Each micro‑frontend’s SeaText client instance runs independently. Performance is identical to using separate configs for each framework. The snippet is asynchronous and under 15 KB.
What happens if one micro‑frontend’s SeaText script fails to load?
Only the module that depends on that script will lose SeaText functionality. Other micro‑frontends will continue to work as expected. This is a general best practice for script loading: failures are isolated. SeaText’s documentation does not explicitly guarantee no cascading failures, but the independent client instances make such failures unlikely.