Vue SPA - How to hide .vue files when rendered in browser










2















I'm working on a Single Page App developed in Vue.js hosted on a node.js server.



At the moment it is still under development but eventually it will be exposed to external customers, and since we will deal with sensitive data we would like to avoid to have the .vue files and the relative file-tree structure visible when users inspect the element in devtool.



See attached screenshot as a sample that shows the files I would like to hide.
enter image description here



Is there a way to achieve that?










share|improve this question

















  • 1





    there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

    – Hamilton Gabriel
    Nov 15 '18 at 1:50












  • Thanks, Hamilton, I'll have a look :)

    – Adriano
    Nov 15 '18 at 2:26











  • I hope it works.

    – Hamilton Gabriel
    Nov 15 '18 at 2:36















2















I'm working on a Single Page App developed in Vue.js hosted on a node.js server.



At the moment it is still under development but eventually it will be exposed to external customers, and since we will deal with sensitive data we would like to avoid to have the .vue files and the relative file-tree structure visible when users inspect the element in devtool.



See attached screenshot as a sample that shows the files I would like to hide.
enter image description here



Is there a way to achieve that?










share|improve this question

















  • 1





    there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

    – Hamilton Gabriel
    Nov 15 '18 at 1:50












  • Thanks, Hamilton, I'll have a look :)

    – Adriano
    Nov 15 '18 at 2:26











  • I hope it works.

    – Hamilton Gabriel
    Nov 15 '18 at 2:36













2












2








2


1






I'm working on a Single Page App developed in Vue.js hosted on a node.js server.



At the moment it is still under development but eventually it will be exposed to external customers, and since we will deal with sensitive data we would like to avoid to have the .vue files and the relative file-tree structure visible when users inspect the element in devtool.



See attached screenshot as a sample that shows the files I would like to hide.
enter image description here



Is there a way to achieve that?










share|improve this question














I'm working on a Single Page App developed in Vue.js hosted on a node.js server.



At the moment it is still under development but eventually it will be exposed to external customers, and since we will deal with sensitive data we would like to avoid to have the .vue files and the relative file-tree structure visible when users inspect the element in devtool.



See attached screenshot as a sample that shows the files I would like to hide.
enter image description here



Is there a way to achieve that?







javascript vue.js vuejs2 ssr






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 0:23









AdrianoAdriano

1,35911426




1,35911426







  • 1





    there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

    – Hamilton Gabriel
    Nov 15 '18 at 1:50












  • Thanks, Hamilton, I'll have a look :)

    – Adriano
    Nov 15 '18 at 2:26











  • I hope it works.

    – Hamilton Gabriel
    Nov 15 '18 at 2:36












  • 1





    there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

    – Hamilton Gabriel
    Nov 15 '18 at 1:50












  • Thanks, Hamilton, I'll have a look :)

    – Adriano
    Nov 15 '18 at 2:26











  • I hope it works.

    – Hamilton Gabriel
    Nov 15 '18 at 2:36







1




1





there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

– Hamilton Gabriel
Nov 15 '18 at 1:50






there is a topic already addressing the same subject. stackoverflow.com/questions/49096454/…

– Hamilton Gabriel
Nov 15 '18 at 1:50














Thanks, Hamilton, I'll have a look :)

– Adriano
Nov 15 '18 at 2:26





Thanks, Hamilton, I'll have a look :)

– Adriano
Nov 15 '18 at 2:26













I hope it works.

– Hamilton Gabriel
Nov 15 '18 at 2:36





I hope it works.

– Hamilton Gabriel
Nov 15 '18 at 2:36












3 Answers
3






active

oldest

votes


















2














It seems you are running on development mode of vue. And Of course files will be visible by then. When shipping a Vue SPA, it should be build and compiled into chunks of JS.



You can build a production version of your spa by running.



npm run build


This will produce 1 folder and 1 file inside the dist



--dist
----static
----index.html


When this were served. No .vue files will be visible anymore.
And when you check it on Browsers Dev tools. It should look more like of this



enter image description here






share|improve this answer






























    1














    The folders node_modules, src, and theme should be a level up in the folder structure. Therefore, you have to modify your paths pointing to those files.



    The app.js can be in that folder only with files that are JS executables.






    share|improve this answer






























      0














      I was able to make webpack export the SPA in a bundle by playing around with the config file.



      In the file ./config/index.js I have changed the following flags:



      build: 
      // other code...

      devtool: '', // Previously it was set as '#source-map'
      productionSourceMap: false, // Previously it was set as true
      cssSourceMap: false, // Previously set as true

      // other code...



      I've found the solution by reading the webpack documentation where it explains what the settings do: https://webpack.js.org/configuration/devtool/#production



      Thanks everyone for putting me in the right direction.






      share|improve this answer






















        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        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: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        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%2fstackoverflow.com%2fquestions%2f53310750%2fvue-spa-how-to-hide-vue-files-when-rendered-in-browser%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        It seems you are running on development mode of vue. And Of course files will be visible by then. When shipping a Vue SPA, it should be build and compiled into chunks of JS.



        You can build a production version of your spa by running.



        npm run build


        This will produce 1 folder and 1 file inside the dist



        --dist
        ----static
        ----index.html


        When this were served. No .vue files will be visible anymore.
        And when you check it on Browsers Dev tools. It should look more like of this



        enter image description here






        share|improve this answer



























          2














          It seems you are running on development mode of vue. And Of course files will be visible by then. When shipping a Vue SPA, it should be build and compiled into chunks of JS.



          You can build a production version of your spa by running.



          npm run build


          This will produce 1 folder and 1 file inside the dist



          --dist
          ----static
          ----index.html


          When this were served. No .vue files will be visible anymore.
          And when you check it on Browsers Dev tools. It should look more like of this



          enter image description here






          share|improve this answer

























            2












            2








            2







            It seems you are running on development mode of vue. And Of course files will be visible by then. When shipping a Vue SPA, it should be build and compiled into chunks of JS.



            You can build a production version of your spa by running.



            npm run build


            This will produce 1 folder and 1 file inside the dist



            --dist
            ----static
            ----index.html


            When this were served. No .vue files will be visible anymore.
            And when you check it on Browsers Dev tools. It should look more like of this



            enter image description here






            share|improve this answer













            It seems you are running on development mode of vue. And Of course files will be visible by then. When shipping a Vue SPA, it should be build and compiled into chunks of JS.



            You can build a production version of your spa by running.



            npm run build


            This will produce 1 folder and 1 file inside the dist



            --dist
            ----static
            ----index.html


            When this were served. No .vue files will be visible anymore.
            And when you check it on Browsers Dev tools. It should look more like of this



            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 15 '18 at 1:47









            keyslkeysl

            852713




            852713























                1














                The folders node_modules, src, and theme should be a level up in the folder structure. Therefore, you have to modify your paths pointing to those files.



                The app.js can be in that folder only with files that are JS executables.






                share|improve this answer



























                  1














                  The folders node_modules, src, and theme should be a level up in the folder structure. Therefore, you have to modify your paths pointing to those files.



                  The app.js can be in that folder only with files that are JS executables.






                  share|improve this answer

























                    1












                    1








                    1







                    The folders node_modules, src, and theme should be a level up in the folder structure. Therefore, you have to modify your paths pointing to those files.



                    The app.js can be in that folder only with files that are JS executables.






                    share|improve this answer













                    The folders node_modules, src, and theme should be a level up in the folder structure. Therefore, you have to modify your paths pointing to those files.



                    The app.js can be in that folder only with files that are JS executables.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 15 '18 at 0:33









                    jordiburgosjordiburgos

                    3,14022753




                    3,14022753





















                        0














                        I was able to make webpack export the SPA in a bundle by playing around with the config file.



                        In the file ./config/index.js I have changed the following flags:



                        build: 
                        // other code...

                        devtool: '', // Previously it was set as '#source-map'
                        productionSourceMap: false, // Previously it was set as true
                        cssSourceMap: false, // Previously set as true

                        // other code...



                        I've found the solution by reading the webpack documentation where it explains what the settings do: https://webpack.js.org/configuration/devtool/#production



                        Thanks everyone for putting me in the right direction.






                        share|improve this answer



























                          0














                          I was able to make webpack export the SPA in a bundle by playing around with the config file.



                          In the file ./config/index.js I have changed the following flags:



                          build: 
                          // other code...

                          devtool: '', // Previously it was set as '#source-map'
                          productionSourceMap: false, // Previously it was set as true
                          cssSourceMap: false, // Previously set as true

                          // other code...



                          I've found the solution by reading the webpack documentation where it explains what the settings do: https://webpack.js.org/configuration/devtool/#production



                          Thanks everyone for putting me in the right direction.






                          share|improve this answer

























                            0












                            0








                            0







                            I was able to make webpack export the SPA in a bundle by playing around with the config file.



                            In the file ./config/index.js I have changed the following flags:



                            build: 
                            // other code...

                            devtool: '', // Previously it was set as '#source-map'
                            productionSourceMap: false, // Previously it was set as true
                            cssSourceMap: false, // Previously set as true

                            // other code...



                            I've found the solution by reading the webpack documentation where it explains what the settings do: https://webpack.js.org/configuration/devtool/#production



                            Thanks everyone for putting me in the right direction.






                            share|improve this answer













                            I was able to make webpack export the SPA in a bundle by playing around with the config file.



                            In the file ./config/index.js I have changed the following flags:



                            build: 
                            // other code...

                            devtool: '', // Previously it was set as '#source-map'
                            productionSourceMap: false, // Previously it was set as true
                            cssSourceMap: false, // Previously set as true

                            // other code...



                            I've found the solution by reading the webpack documentation where it explains what the settings do: https://webpack.js.org/configuration/devtool/#production



                            Thanks everyone for putting me in the right direction.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 15 '18 at 3:39









                            AdrianoAdriano

                            1,35911426




                            1,35911426



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • 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%2fstackoverflow.com%2fquestions%2f53310750%2fvue-spa-how-to-hide-vue-files-when-rendered-in-browser%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







                                這個網誌中的熱門文章

                                Barbados

                                How to read a connectionString WITH PROVIDER in .NET Core?

                                Node.js Script on GitHub Pages or Amazon S3