0

I'm looking at changing an existing webpart. But unfortunately there is no source code stored any where.

Is it possible reverse engineer sppkg file? I mean extract source code from .sppkg file.

Thanks in advance.

1

2 Answers 2

2

As far as I know, we cannot get the source typescript file from the .sppkg file.

The .sppkg file is actually a zip archive that can be extracted, and you can rename it to .zip extension and extract it, but it contains the compiled and minified js files, not the source typescript file.

Similar issue for reference: Spfx source files from spkg

3
  • Thanks Ganesh but what can I do with the bundled J'S.Can I change and redeploy it?
    – naijacoder
    Oct 16, 2022 at 7:23
  • Thanks Zella msft
    – naijacoder
    Oct 19, 2022 at 3:02
  • @Zella_msft This is what I explained in my answer given below :) Oct 20, 2022 at 12:02
0

You might not be able to extract the complete TypeScript code as it was before packaging.

But you have below options to get the bundled JavaScript from SPFx package:

1. From developer console of browser:

If you add a client-side web part on site page and use F12 browser tools you can see the code which is bundled into a big JavaScript file by webpack. It might be minified JS.

Reference: Reverse engineer TypeScript output back to source code?

2. Rename to .zip:

You can rename .sppkg file to a .zip file and extract it. You'll get the bundled JavaScript from it.

Reference: Extract source code from .sppkg file

1
  • @naijacoder does this answer help you in any way? Oct 20, 2022 at 12:01

Your Answer

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

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