[SOLVED] How to add a webpack plugin (and require file)?



  • I am trying to use this plugin (https://www.npmjs.com/package/merge-jsons-webpack-plugin) and integrate with quasar.conf.js. But when I add

    let MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin")
    

    to the top of my quasar config file, I get an error: (node:21762) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'dev' before initialization I have also tried moving the line to inside the module.exports block, but also it fails. my extend code and build block itself looks like this:

    build: {
          rtl: true,
          scopeHoisting: true,
          vueRouterMode: 'history',
          // vueCompiler: true,
          // gzip: true,
          // analyze: true,
          // extractCSS: false,
          extendWebpack (cfg) {
            cfg.resolve.alias['vue'] = 'vue/dist/vue.common'
            cfg.module.rules.push({
              enforce: 'pre',
              test: /\.(js|vue)$/,
              loader: 'eslint-loader',
              exclude: /node_modules/
            }),
            cfg.module.rules.push({
              resourceQuery: /blockType=i18n/,
              type: 'javascript/auto',
              use: [
                {loader: '@kazupon/vue-i18n-loader'}
              ]
            }),
            cfg.plugins.push(
              new MergeJsonWebpackPlugin({
                "files": [
                  "./jsons/file1.json",
                  "./jsons/file3.json",
                  "./jsons/file2.json"
                ],
                "output": {
                  "fileName": "./dist/result.json"
                }
              })
            )
          }
        },
    

    Any ideas how to get this plugin to work/load?



  • Any suggestions at all? I’m totally stuck with this.



  • Good news, this was fixed by updating to the most recent quasar (from 1.8.2 to 1.8.3), so I guess the bug was there because the rest of my code remained exactly as above.


Log in to reply