electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.66k stars 1.74k forks source link

build directory not being included in asar archive #976

Closed antonycourtney closed 7 years ago

antonycourtney commented 7 years ago

I use webpack to build my application and have it set to write generated bundles to ./build in the project directory. I run both the main process entry and the render process through webpack, so my "main" entry in package.json is:

"main": "./build/main.bundle.js",

When running electron-builder I continually get an error message indicating that the files in the build directory are not being included in the generated Resources/app.asar archive. I've tried adding them explicitly in numerous ways: I've tried:

Relevant snippet of package.json:

  "build": {
    "appId": "com.antonycourtney.tad",
    "category": "DataVisualization",
    "files": [
      "build",
      "node_modules"
    ]
  },

Error message I see is below. Unfortunately I'm including some native code library dependencies, so it takes more than a minute to build those native libraries before I get the error message below.

Is there any way to debug the file globs to see what's going in to (or excluded from) the generated asar archive, and why? Is there anything magical about the directory named 'build' that prevents it from being included? Any examples of another project using webpack and electron-builder?
Any help greatly appreciated. Thank You!

Gamma:tad antony$ npm run dist

> tad@0.6.0 dist /Users/antony/home/src/tad
> build

Rebuilding native production dependencies for arch x64
Packaging for darwin x64 using electron 1.4.7 to dist/mac
⚠️  Application icon is not set, default Electron icon will be used
Error: Application entry file "build/main.bundle.js" in the "/Users/antony/home/src/tad/dist/mac/Tad.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.
...
develar commented 7 years ago

Root directory build it is build resources directory by default, please see https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources

You need to change buildResources option.

sylhero commented 7 years ago

it still doesn't work I added

"directories": {
        "buildResources": "./electron-config", //contains main.js
        "output": "dist"
    },

and I updated my main: "electron-config/main.js" also tried main.js ./main.js I got the same error again

sylhero commented 7 years ago

alright finally make it work: add the main.js into the files then it can find it now