How to minify JavaScript with js error












1















I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.










share|improve this question





























    1















    I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.










    share|improve this question



























      1












      1








      1








      I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.










      share|improve this question
















      I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.







      magento2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 28 '18 at 12:26









      Bare Feet

      1,5591732




      1,5591732










      asked Sep 28 '18 at 3:31









      Magento BugMagento Bug

      1598




      1598






















          3 Answers
          3






          active

          oldest

          votes


















          0














          I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section and redeploy static content






          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07



















          0














          Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
          .
          In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:



          bin/magento deploy:mode:set production --skip-compilation


          Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:



          bin/magento cache:clean
          bin/magento setup:upgrade
          bin/magento setup:static-content:deploy





          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07











          • Please post your error message and file name in the question.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 4:46











          • there is no way to minify js without debuging the error ?

            – Magento Bug
            Sep 29 '18 at 18:08











          • How can we help until you show us your error.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 19:36











          • prntscr.com/l09ptk

            – Magento Bug
            Sep 29 '18 at 20:21



















          0














          To merge JavaScript files in Magento 2:



          Navigate to Admin panel > Stores > Configuration > Advanced > Developer



          Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.



          When complete, click Save Config.





          If the above solution is not working for you due to some bugs or errors, I would try this gulp solution



          Take a look at this: How to minify/optimise Javascript on Magento 2?



          Although, I would strongly recommend fixing the error.






          share|improve this answer


























          • ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

            – Magento Bug
            Sep 28 '18 at 22:09











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          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%2fmagento.stackexchange.com%2fquestions%2f244226%2fhow-to-minify-javascript-with-js-error%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









          0














          I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section and redeploy static content






          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07
















          0














          I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section and redeploy static content






          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07














          0












          0








          0







          I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section and redeploy static content






          share|improve this answer













          I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section and redeploy static content







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 28 '18 at 12:16









          Rv SinghRv Singh

          657417




          657417













          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07



















          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07

















          sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

          – Magento Bug
          Sep 28 '18 at 22:07





          sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

          – Magento Bug
          Sep 28 '18 at 22:07













          0














          Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
          .
          In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:



          bin/magento deploy:mode:set production --skip-compilation


          Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:



          bin/magento cache:clean
          bin/magento setup:upgrade
          bin/magento setup:static-content:deploy





          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07











          • Please post your error message and file name in the question.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 4:46











          • there is no way to minify js without debuging the error ?

            – Magento Bug
            Sep 29 '18 at 18:08











          • How can we help until you show us your error.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 19:36











          • prntscr.com/l09ptk

            – Magento Bug
            Sep 29 '18 at 20:21
















          0














          Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
          .
          In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:



          bin/magento deploy:mode:set production --skip-compilation


          Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:



          bin/magento cache:clean
          bin/magento setup:upgrade
          bin/magento setup:static-content:deploy





          share|improve this answer
























          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07











          • Please post your error message and file name in the question.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 4:46











          • there is no way to minify js without debuging the error ?

            – Magento Bug
            Sep 29 '18 at 18:08











          • How can we help until you show us your error.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 19:36











          • prntscr.com/l09ptk

            – Magento Bug
            Sep 29 '18 at 20:21














          0












          0








          0







          Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
          .
          In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:



          bin/magento deploy:mode:set production --skip-compilation


          Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:



          bin/magento cache:clean
          bin/magento setup:upgrade
          bin/magento setup:static-content:deploy





          share|improve this answer













          Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
          .
          In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:



          bin/magento deploy:mode:set production --skip-compilation


          Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:



          bin/magento cache:clean
          bin/magento setup:upgrade
          bin/magento setup:static-content:deploy






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 28 '18 at 12:17









          Sourabh Kumar SharmaSourabh Kumar Sharma

          665316




          665316













          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07











          • Please post your error message and file name in the question.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 4:46











          • there is no way to minify js without debuging the error ?

            – Magento Bug
            Sep 29 '18 at 18:08











          • How can we help until you show us your error.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 19:36











          • prntscr.com/l09ptk

            – Magento Bug
            Sep 29 '18 at 20:21



















          • sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

            – Magento Bug
            Sep 28 '18 at 22:07











          • Please post your error message and file name in the question.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 4:46











          • there is no way to minify js without debuging the error ?

            – Magento Bug
            Sep 29 '18 at 18:08











          • How can we help until you show us your error.

            – Sourabh Kumar Sharma
            Sep 29 '18 at 19:36











          • prntscr.com/l09ptk

            – Magento Bug
            Sep 29 '18 at 20:21

















          sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

          – Magento Bug
          Sep 28 '18 at 22:07





          sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .

          – Magento Bug
          Sep 28 '18 at 22:07













          Please post your error message and file name in the question.

          – Sourabh Kumar Sharma
          Sep 29 '18 at 4:46





          Please post your error message and file name in the question.

          – Sourabh Kumar Sharma
          Sep 29 '18 at 4:46













          there is no way to minify js without debuging the error ?

          – Magento Bug
          Sep 29 '18 at 18:08





          there is no way to minify js without debuging the error ?

          – Magento Bug
          Sep 29 '18 at 18:08













          How can we help until you show us your error.

          – Sourabh Kumar Sharma
          Sep 29 '18 at 19:36





          How can we help until you show us your error.

          – Sourabh Kumar Sharma
          Sep 29 '18 at 19:36













          prntscr.com/l09ptk

          – Magento Bug
          Sep 29 '18 at 20:21





          prntscr.com/l09ptk

          – Magento Bug
          Sep 29 '18 at 20:21











          0














          To merge JavaScript files in Magento 2:



          Navigate to Admin panel > Stores > Configuration > Advanced > Developer



          Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.



          When complete, click Save Config.





          If the above solution is not working for you due to some bugs or errors, I would try this gulp solution



          Take a look at this: How to minify/optimise Javascript on Magento 2?



          Although, I would strongly recommend fixing the error.






          share|improve this answer


























          • ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

            – Magento Bug
            Sep 28 '18 at 22:09
















          0














          To merge JavaScript files in Magento 2:



          Navigate to Admin panel > Stores > Configuration > Advanced > Developer



          Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.



          When complete, click Save Config.





          If the above solution is not working for you due to some bugs or errors, I would try this gulp solution



          Take a look at this: How to minify/optimise Javascript on Magento 2?



          Although, I would strongly recommend fixing the error.






          share|improve this answer


























          • ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

            – Magento Bug
            Sep 28 '18 at 22:09














          0












          0








          0







          To merge JavaScript files in Magento 2:



          Navigate to Admin panel > Stores > Configuration > Advanced > Developer



          Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.



          When complete, click Save Config.





          If the above solution is not working for you due to some bugs or errors, I would try this gulp solution



          Take a look at this: How to minify/optimise Javascript on Magento 2?



          Although, I would strongly recommend fixing the error.






          share|improve this answer















          To merge JavaScript files in Magento 2:



          Navigate to Admin panel > Stores > Configuration > Advanced > Developer



          Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.



          When complete, click Save Config.





          If the above solution is not working for you due to some bugs or errors, I would try this gulp solution



          Take a look at this: How to minify/optimise Javascript on Magento 2?



          Although, I would strongly recommend fixing the error.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 12 mins ago









          Pang

          10515




          10515










          answered Sep 28 '18 at 10:22









          Bare FeetBare Feet

          1,5591732




          1,5591732













          • ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

            – Magento Bug
            Sep 28 '18 at 22:09



















          • ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

            – Magento Bug
            Sep 28 '18 at 22:09

















          ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

          – Magento Bug
          Sep 28 '18 at 22:09





          ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .

          – Magento Bug
          Sep 28 '18 at 22:09


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento 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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244226%2fhow-to-minify-javascript-with-js-error%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

          Magento 2 controller redirect on button click in phtml file

          Polycentropodidae