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
-
@smellydogcoding The best way to insure that your boot file gets loaded in the right place such as Client/Server is in the Boot Section in your quasar.conf.js
boot: [“i18n”, “axios”, { path: “hello”, server: false }]
Read more … https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr#Boot-Files