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-builder causes SyntaxError: Cannot use import statement outside a module

    Framework
    2
    2
    831
    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.
    • K
      keechan last edited by keechan

      I just started using electron-builder instead of electron-packager.

      I have added this to my package.json:

        "main": "./src-electron/main-process/electron-main.js",
        "build": {
          "productName": "someproductname",
          "win": {
             "target": ["portable"]
          },
         "portable": {
            "artifactName": "someproductnameport.exe"
          }
        },
      

      And in my quasar.conf.js:

            builder: {
              appId: 'com.electron.someproductname',
              nsis: {
                target: 'portable'
              }
            },
      

      It generates the bundle ok but when I try to run it, I get this error:
      import { app, BrowserWindow, nativeTheme } from 'electron'

      Error.JPG

      What am I doing wrong? Thanks!

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

        Just a hunch, have you tried using require() instead of import for this case?

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