1

With includeClientSideAssets one can pack everything into single .sppkg package. But how can I add additional resources to .sppkg package and reference those correctly in SPFx code?

e.g. I have usermanual-v1.pdf document which I would like to include in .sppkg package and then I should be able to open it via link (<a href="usermanual-v1.pdf">Manual</a>) in HTML.

PDF is over 5 megabytes so I cannot base64 it into the page. Filename has so be same but path can be appended to it (e.g. cdn/documents/usermanual-v1.pdf would be fine).

1 Answer 1

1

One of the ways to do that would be to require the file from a TS file and then pass the URL to the view (html) However I'm not sure PDF are supported by the webpack configuration included with the sharepoint framework currently. You could potentially override the configuration but that can be tricky.

Depending on your scenario levering pnp provisioning template (deployed by a custom gulp task, a back end azure function...) Might work.

Also using the upload to sharepoint gulp task as part of the pipeline could be a solution but the PDF would not be part of the package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.