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.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI'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.
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
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