We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca546d8 commit 92b6fecCopy full SHA for 92b6fec
.changeset/hip-pandas-care.md
@@ -0,0 +1,5 @@
1
+---
2
+"@module-federation/nextjs-mf": patch
3
4
+
5
+Make the Next.js plugin work with strict CSP settings
packages/nextjs-mf/src/plugins/container/runtimePlugin.ts
@@ -72,7 +72,12 @@ export default function (): FederationRuntimePlugin {
72
73
var moduleCache = args.origin.moduleCache;
74
var name = args.origin.name;
75
- var gs = new Function('return globalThis')();
+ var gs;
76
+ try {
77
+ gs = new Function('return globalThis')();
78
+ } catch (e) {
79
+ gs = globalThis; // fallback for browsers without 'unsafe-eval' CSP policy enabled
80
+ }
81
var attachedRemote = gs[name];
82
if (attachedRemote) {
83
moduleCache.set(name, attachedRemote);
0 commit comments