No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Setting Webpack Terser settings for build

    Help
    1
    2
    471
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • metcarob
      metcarob last edited by

      I have a pwa quasar application. I use codefresh to build it. This is a simular service to circleCI.
      I see the error:

      App · Compiling PWA...                                                                                                                                          
      App · Compiled PWA done in 108943 ms                                                                                                                            
                                                                                                                                                                      
      App · ⚠️  1 error encountered:                                                                                                                                  
                                                                                                                                                                      
      js/vendor.4c4ee126.js from Terser                                                                                                                                
       Error: Call retries were exceeded                                                                                                                              
                                                                                                                                                                      
       - ChildProcessWorker.js:193 ChildProcessWorker.initialize                                                                                                      
         [frontend]/[jest-worker]/build/workers/ChildProcessWorker.js:193:21                                                                                          
                                                                                                                                                                      
       - ChildProcessWorker.js:274 ChildProcessWorker._onExit                                                                                                         
         [frontend]/[jest-worker]/build/workers/ChildProcessWorker.js:274:12                                                                                          
                                                                                                                                                                      
       - child_process.js:248 Process.ChildProcess._handle.onexit                                                                                                     
         internal/child_process.js:248:12
      

      My guess is I am suffering from this issue:
      https://github.com/webpack-contrib/terser-webpack-plugin/issues/202

      The fix aparantly is to specify parallel in my webpack.config.js Something like as follows:

      module.exports = {
        optimization: {
          minimize: true,
          minimizer: [
            new TerserPlugin({
              parallel: 1,
            }),
          ],
        },
      };
      

      That’s find but Quasar dosen’t seem to have a webpack.config.js.
      I have used the command

      quasar inspect -m pwa
      

      To see it but when I search this output I can’t find any reference to Terser or parallel.

      I have read through https://quasar.dev/quasar-cli/handling-webpack#introduction but it is not clear to me how providing a extendWebpack function changes the webpack configuration file.

      I also think I need to add the line

      const TerserPlugin = require("terser-webpack-plugin");
      

      somewhere but have no idea where. (Maybe in the extendWebpack function??)

      Any pointers would be apreciated.
      Robert

      1 Reply Last reply Reply Quote 0
      • metcarob
        metcarob last edited by

        I managed to resolve my own issue with a bit of a hailmary guess.

        First I added this to the top of quasar.conf.js:

        const TerserPlugin = require("terser-webpack-plugin");
        

        Next I added the following to the build section

              extendWebpack (cfg) {
                cfg.optimization.minimize = true
                cfg.optimization.minimizer = [new TerserPlugin({
                  parallel: 1
                })]
              }
        

        I then ran my deployment process on codefresh and it worked!

        That took a lot of trail and error to get to. Hopefully this post will be helpful for someone else.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post