Skip to content
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

Unable to change reference from static2.sharepointonline.com in SPFx project #29697

Closed
2 tasks done
jlara005 opened this issue Oct 30, 2023 · 1 comment
Closed
2 tasks done
Labels
Fluent UI react (v8) Issues about @fluentui/react (v8)

Comments

@jlara005
Copy link

jlara005 commented Oct 30, 2023

Libraries

Node version: v8.17.0

Package version(s):

  • @office-ui-fabric-react: ^5.135.6
  • @microsoft/sp-core-library: ~1.4.0
  • @microsoft/sp-application-base: ~1.4.0
  • react: 15.6.2
  • @uifabric/styling: 5.37.0

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
    Memory: 25.51 GB / 32.00 GB
  Browsers:
    Edge: Spartan (44.22621.2283.0), Chromium (118.0.2088.69)
    Internet Explorer: 11.0.22621.1

Are you reporting Accessibility issue?

no

Reproduction

https://github.com/jlara005/TestAppCustomizer

Bug Description

I am working on a SharePoint SE on-premises SPFx application customizer project and because of security reasons there is no internet access. The fonts keep being fetched from https://static2.sharepointonline.com/files/fabric/assets/fonts.

I have tried to set the fontBaseUrl window property before all imports on the main entrypoint file TestAppCustomizerApplicationCustomizer.ts file and the reference to static2.sharepointonline.com still remains. Seems like the imports are being evaluated before the property is being set. How can I set this on an application customizer SPFx project?

Actual behavior:

  • Several CSS/Font assets have to be fetched from CDN every time.
  • Adding the following property to the window object before all imports on the main entrypoint file doesn't work
    window.FabricConfig = {
    fontBaseUrl: 'https://mycdn.com'
    };
  • Network requests stay same. There is no request for own CDN.

Expected behavior:

  • Setting the property will allow override to default url
  • All CSS/Font dependencies should be included as part of the NPM package.

CDN

Related Issues

This issue is related to 11477 which was never really given a solution: #11477

Logs

No response

Requested priority

Blocking

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@github-actions github-actions bot added Fluent UI react (v8) Issues about @fluentui/react (v8) Needs: Triage 🔍 labels Oct 30, 2023
@miroslavstastny
Copy link
Member

The requirement for the CDN override to work is to change the fontBaseUrl before fabric is loaded, as described in #10363 (comment).

This codesandbox shows that in that case the custom CDN is used: https://codesandbox.io/s/customizing-fabric-icons-and-fonts-forked-8scp75?file=/src/alternativeCDNs.tsx
image

I would suggest you to follow up in the SPFx issue SharePoint/sp-dev-docs/issues/9307

@miroslavstastny miroslavstastny closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react (v8) Issues about @fluentui/react (v8)
Projects
None yet
Development

No branches or pull requests

2 participants