electron-webpack icon indicating copy to clipboard operation
electron-webpack copied to clipboard

Source-map-support module not found

Open twigs67 opened this issue 5 years ago • 1 comments

Hello,

I'm having an issue building my app. With Apple's new changes I had to remove all node_modules from the extraResources config.

However, now that I removed it, I'm getting the error when trying to run the app "cannot find module 'source-map-support'". Problem is, that I keep getting an error with each new item I add to extraResources config. I'm now down to electron-updater.

Here is my config

  "build": {
    "extraResources": [
        "./node_modules/source-map-support",
        "./node_modules/source-map",
        "./node_modules/buffer-from",
        "./node_modules/electron-updater"
    ],
    "files": [
        "!node_modules"
    ],
    "asar": true,
    "mac": {
      "target": [
        "dmg",
        "zip"
      ],
      "hardenedRuntime": true,
      "entitlements": "./build/entitlements.mac.plist",
      "entitlementsInherit": "./build/entitlements.mac.plist",
      "gatekeeperAssess": false,
      "cscLink": "build/DevApp_cert.p12",
      "cscInstallerLink": "build/devInstaller_cert.p12"
    }
    ,
    "afterSign": "./build/afterSignHook.js",
    "dmg": {
        "sign": false
    }
  },

I was thinking, that since source-map-support is being used by electron-webpack, you might have an idea of what I can do. I imagine there's a better way than this?

Any help would be appreciated.

twigs67 avatar Feb 11 '20 19:02 twigs67

AFAIK You shouldn't have to add anything to extra resources, if you need anything as a dep for the main process add it to the whiteListedModules in electron-webpack.json and all others should just be handled automatically... Electron webpack tries to be smart and adds a bunch of stuff to the webpack externals config and I had to manually clear that and pass an empty array in my webpack config override in order to get the app building fine and just to be clear you do need source-map-support as an explicit dependency since it's used in the auto-generated index.html.... hope this helps!

alexweber avatar Apr 08 '20 13:04 alexweber