Contents of SPFx deployment package












2














When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



I know these are dependencies for development.



Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










share|improve this question





























    2














    When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



    I know these are dependencies for development.



    Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










    share|improve this question



























      2












      2








      2


      1





      When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



      I know these are dependencies for development.



      Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










      share|improve this question















      When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



      I know these are dependencies for development.



      Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?







      sharepoint-online spfx spfx-webparts spfx-extensions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago

























      asked 2 hours ago









      Asad Refai

      5,11782349




      5,11782349






















          1 Answer
          1






          active

          oldest

          votes


















          3














          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "232"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f255059%2fcontents-of-spfx-deployment-package%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            TLDR;



            The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



            Long answer



            SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

            If you take a look at webpack configuration, you will see below picture:



               ....
            devtool: 'source-map',
            entry:
            { 'hello-world-web-part':
            'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
            'my-new-wp-web-part':
            'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
            externals:
            [ '@microsoft/sp-lodash-subset',
            '@microsoft/sp-core-library',
            '@microsoft/decorators',
            '@microsoft/office-ui-fabric-react-bundle',
            '@microsoft/sp-diagnostics',
            '@microsoft/sp-dynamic-data',
            '@microsoft/sp-polyfills',
            '@microsoft/sp-http',
            '@microsoft/sp-page-context',
            '@microsoft/sp-loader',
            '@microsoft/sp-component-base',
            '@microsoft/sp-webpart-base',
            '@microsoft/sp-office-ui-fabric-core',
            '@microsoft/sp-extension-base',
            '@microsoft/sp-application-base',
            '@microsoft/sp-client-preview',
            '@microsoft/sp-webpart-workbench',
            'react',
            'react-dom',
            'HelloWorldWebPartStrings',
            'MyNewWpWebPartStrings' ],
            output:
            ....


            Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

            Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

            From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



            Additional reading:



            250+ vulnerabilities in a new SharePoint Framework project
            Don't be alarmed by vulnerabilities after running NPM Install
            Code Security Audit using “npm audit”






            share|improve this answer


























              3














              TLDR;



              The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



              Long answer



              SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

              If you take a look at webpack configuration, you will see below picture:



                 ....
              devtool: 'source-map',
              entry:
              { 'hello-world-web-part':
              'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
              'my-new-wp-web-part':
              'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
              externals:
              [ '@microsoft/sp-lodash-subset',
              '@microsoft/sp-core-library',
              '@microsoft/decorators',
              '@microsoft/office-ui-fabric-react-bundle',
              '@microsoft/sp-diagnostics',
              '@microsoft/sp-dynamic-data',
              '@microsoft/sp-polyfills',
              '@microsoft/sp-http',
              '@microsoft/sp-page-context',
              '@microsoft/sp-loader',
              '@microsoft/sp-component-base',
              '@microsoft/sp-webpart-base',
              '@microsoft/sp-office-ui-fabric-core',
              '@microsoft/sp-extension-base',
              '@microsoft/sp-application-base',
              '@microsoft/sp-client-preview',
              '@microsoft/sp-webpart-workbench',
              'react',
              'react-dom',
              'HelloWorldWebPartStrings',
              'MyNewWpWebPartStrings' ],
              output:
              ....


              Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

              Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

              From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



              Additional reading:



              250+ vulnerabilities in a new SharePoint Framework project
              Don't be alarmed by vulnerabilities after running NPM Install
              Code Security Audit using “npm audit”






              share|improve this answer
























                3












                3








                3






                TLDR;



                The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



                Long answer



                SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

                If you take a look at webpack configuration, you will see below picture:



                   ....
                devtool: 'source-map',
                entry:
                { 'hello-world-web-part':
                'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
                'my-new-wp-web-part':
                'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
                externals:
                [ '@microsoft/sp-lodash-subset',
                '@microsoft/sp-core-library',
                '@microsoft/decorators',
                '@microsoft/office-ui-fabric-react-bundle',
                '@microsoft/sp-diagnostics',
                '@microsoft/sp-dynamic-data',
                '@microsoft/sp-polyfills',
                '@microsoft/sp-http',
                '@microsoft/sp-page-context',
                '@microsoft/sp-loader',
                '@microsoft/sp-component-base',
                '@microsoft/sp-webpart-base',
                '@microsoft/sp-office-ui-fabric-core',
                '@microsoft/sp-extension-base',
                '@microsoft/sp-application-base',
                '@microsoft/sp-client-preview',
                '@microsoft/sp-webpart-workbench',
                'react',
                'react-dom',
                'HelloWorldWebPartStrings',
                'MyNewWpWebPartStrings' ],
                output:
                ....


                Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

                Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

                From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



                Additional reading:



                250+ vulnerabilities in a new SharePoint Framework project
                Don't be alarmed by vulnerabilities after running NPM Install
                Code Security Audit using “npm audit”






                share|improve this answer












                TLDR;



                The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



                Long answer



                SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

                If you take a look at webpack configuration, you will see below picture:



                   ....
                devtool: 'source-map',
                entry:
                { 'hello-world-web-part':
                'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
                'my-new-wp-web-part':
                'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
                externals:
                [ '@microsoft/sp-lodash-subset',
                '@microsoft/sp-core-library',
                '@microsoft/decorators',
                '@microsoft/office-ui-fabric-react-bundle',
                '@microsoft/sp-diagnostics',
                '@microsoft/sp-dynamic-data',
                '@microsoft/sp-polyfills',
                '@microsoft/sp-http',
                '@microsoft/sp-page-context',
                '@microsoft/sp-loader',
                '@microsoft/sp-component-base',
                '@microsoft/sp-webpart-base',
                '@microsoft/sp-office-ui-fabric-core',
                '@microsoft/sp-extension-base',
                '@microsoft/sp-application-base',
                '@microsoft/sp-client-preview',
                '@microsoft/sp-webpart-workbench',
                'react',
                'react-dom',
                'HelloWorldWebPartStrings',
                'MyNewWpWebPartStrings' ],
                output:
                ....


                Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

                Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

                From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



                Additional reading:



                250+ vulnerabilities in a new SharePoint Framework project
                Don't be alarmed by vulnerabilities after running NPM Install
                Code Security Audit using “npm audit”







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                Sergei Sergeev

                9,86352342




                9,86352342






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to SharePoint Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f255059%2fcontents-of-spfx-deployment-package%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Morgemoulin

                    Scott Moir

                    Souastre