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

    Electron with MSSQL or Tedious SQL

    Framework
    mssql quasar quasar electron tedious webpack
    4
    9
    825
    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.
    • Q
      QuaSam last edited by

      I am hoping someone has implemented SQL Access from Quasar with either Tedious or MSSQL, as I have been unsuccessful trying it - although it works with Electron sans Quasar. The error is TypeError: webpack_require(…) is not a function_
      In the Electron non-Quasar solution, the use of require works ok. Is there any specific solution for this condition with tedious/mssql, or is there a general way to convert from require to import that will circumvent this error? (#9379 addresses this problem but I do not see a solution there)

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

        @QuaSam turn on nodeIntegration maybe.

        Q 1 Reply Last reply Reply Quote 0
        • Q
          QuaSam @metalsadman last edited by

          @metalsadman Thank you. However, nodeIntegration: true is already set in quasar.config.js. I am attempting to get either tedious or mssql to work, but from what I have read mssql / msnodeV8 are only compatible with electron < V6 (I re-loaded electron to version 5.0.13 with no success; same problem). I am dead in the water trying to integrate tedious, mssql or other method to get Quasar Electron to access Azure SQL. I think the issue is simply getting the modules loaded correctly. The error I have now is: [vue-router] Failed to resolve async component default: TypeError: webpack_require is not a function.

          1 Reply Last reply Reply Quote 0
          • Q
            QuaSam last edited by

            The following link has a suggested solution. However, would anyone care to comment as to the efficacy of this suggestion, and if it makes sense, what would be needed in the Quasar configuration files to designate externals and/or his “electron-renderer” idea? Thanks to all.
            http://www.matthiassommer.it/software-architecture/webpack-node-modules/
            How can we expose the Node modules globally in our project? We have to define them as externals in our webpack.config.js:

            module.exports = {
            “externals”: {
            “electron”: “require(‘electron’)”,
            “child_process”: “require(‘child_process’)”,
            “fs”: “require(‘fs’)”,
            “path”: “require(‘path’)”
            [remainder omitted]
            }
            },
            Solution for Electron users
            If you are using Electron and it still does not work, try the following things in addition.

            Add target:’electron-renderer’ to module.exports in the Webpack configuration. Others also recommend to use this NPM package: webpack-target-electron-renderer

            1 Reply Last reply Reply Quote 0
            • Q
              QuaSam last edited by

              I returned to this task and got it running: npm module MSSQL allows Node.js access to SQL Server and in my case Azure SQL. However, Quasar Electron did not run, although non-Quasar Electron did. MSSQL uses one of two drivers: tedious (default) or msnodesqlv8. Not getting tedious to work I tried msnodesqlv8, noting in the doco for mssql one must specify this with var sql = require(‘mssql/msnodesqlv8’). However, this generated a different error that something was built with wrong npm version (whatever) but in researching msnodesqlv8 doco it said for use with Electron one should run npm module electron-rebuild (see its doco for how to run, not straightforward). But ultimately it is working. So: 1) use mssql, 2) specify use of msnodesqlv8, 3) run electron-rebuild and hopefully your Quasar Electron App can talk to Azure SQL.

              1 Reply Last reply Reply Quote 1
              • B
                Berkmann18 last edited by

                @QuaSam So am I right in assuming that you did manage to get Quasar to work with MSSSQL? Just to see if it’s feasible for my case.

                1 Reply Last reply Reply Quote 0
                • Q
                  QuaSam last edited by

                  Sorry not to see this until now. Yes, I do have MSSQL working as of 4/18 with Azure SQL in a Quasar Electron application. It has been a while so it would take me some digging to see what I did to get things working. I do not recall doing anything other than downloading everything I used once again; I cannot recall if I had to do anything with tedious but I don’t think so. Used: npm modules mssql and ALSO msnodesqlV8. Sam
                  (PS for anyone interested: I’m working on a series of basic Quasar programs SPA and Electron that I’m calling Quick Quasar.)

                  1 Reply Last reply Reply Quote 0
                  • W
                    walfin last edited by

                    Try using window.require instead of require perhaps?

                    1 Reply Last reply Reply Quote 0
                    • Q
                      QuaSam last edited by QuaSam

                      Quasar Upgrade MSSQL fails FIXED (Inegalantly): Working on a new program, I had MSSQL working but I when upgraded Quasar, the problem re-appeared, and it caused an older program that was working to no longer compile with the same errors. I’ve upgraded NPM, VS Build tools, reinstalled MSSQL, tedious and msnodesqlv8 modules; ran electron-rebuild. Two modes of failure, below. Non-Quasar Electron program using MSSQL still works, so problem is definitely introduced by Quasar. Sam
                      Two methods, each with different error message:
                      import sql from ‘mssql’ <using default driver tedious> gets webpack_require is not a function
                      import sql from ‘mssql/msnodesqlv8’ gets "specified module could not be found: node_modules\msnodesquv8\build\Release/ec1\0188…node
                      Ahah (Ugh): By trial and error I got it to work with the following Webpack theatrics, including null-loader. If anyone can figure out what is the right way to do this I would like to know and hopefully others can use Quasar Electron MSSQL (and Azure SQL): <7/2: I ended up using msnodesqlv8 rather than default tedious, as for some reason I could not get the connection to complete. Other settings that may or may not matter: bundler: ‘builder’ and target: ‘electron-renderer’ )
                      // https://quasar.dev/quasar-cli/handling-webpack
                      extendWebpack (cfg) {
                      cfg.module.rules.push({
                      enforce: ‘pre’,
                      test: /.(js|vue)$/,
                      loader: ‘eslint-loader’,
                      exclude: /node_modules/
                      })
                      cfg.externals = {
                      mssql: “require(‘mssql’)”,
                      tedious: “require(‘tedious’)”,
                      msnodesqlv8: “require(‘msnodesqlv8’)” // added 7/2
                      }
                      cfg.module.rules.push({
                      test: /.node$/,
                      use: ‘node-loader’
                      })
                      cfg.target = ‘electron-renderer’
                      // 7/1/20 trying this see
                      cfg.module.rules.push({
                      test: /.mssql$/,
                      loader: ‘null-loader’
                      })
                      cfg.module.rules.push({
                      test: /(tedious)/,
                      loader: ‘null-loader’
                      })
                      }

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