Skip to content

fix(nextjs-mf): Try CSP-safe method for getting globalThis first #3776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mitchellrj
Copy link

Description

Where unsafe-eval is not permitted in a Content Security Policy, trying the Function approach first then falling back causes unnecessary CSP Reports and errors to be logged by the browser. This approach uses globalThis by default, then attempts to catch the Webpack rewriting of it.

Related Issue

#3772

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

changeset-bot bot commented May 15, 2025

🦋 Changeset detected

Latest commit: bbe342e

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

This PR includes changesets to release 1 package
Name Type
@module-federation/nextjs-mf Minor

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

Copy link

netlify bot commented May 15, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit bbe342e
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/68275854e98601000829ad1b
😎 Deploy Preview https://deploy-preview-3776--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mitchellrj mitchellrj changed the title Try CSP-safe method for getting globalThis first fix(nextjs-mf): Try CSP-safe method for getting globalThis first May 15, 2025
@ScriptedAlchemy
Copy link
Member

@mitchellrj run pnpm changeset add

@ScriptedAlchemy
Copy link
Member

@mitchellrj bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants