How do I modify the output key in webpack config



  • I am trying to implement pdfvuer (which is based on PDF JS) in a project. I keep getting an error in the console: ReferenceError: window is not defined. Based on what I’ve read, this seems to be the solution:

    Edit (or create) vue.config.js and change webpack configuration there:

    module.exports = { configureWebpack: config => { config.output.globalObject = "this"; } }
    

    How do I impliment this in quasar.conf.js?



  • I found the solution using chainWebpack. Add this to the build section of your quasar.conf.js:

    build: {
      chainWebpack (chain) {
        chain.output.globalObject('this')
      }
    }
    


  • Nice solution. I came across the same error using that package 🙂


Log in to reply