Search code examples
javascriptelectronelectron-packager

electron-packager excludes .obj model files in built application


I'm building an Electron application, and testing out the electron-packager library. When I simply run electron-packager ., I get the expected build, save for the fact that none of my .obj model files are included in the build. Their parent directories as well as sibling files are included in the build, just not the .obj files.

Any insight would be appreciated.


Solution

  • For those in the future, the electron-packager module is written for both Windows and Unix systems. During the .exe compilation process, Windows generates .obj files. Since this is the case, electron-packager has added .obj files to the file ignore.js, which thereby prevents .obj 3d models from being included in resulting binaries.

    See this issue on GitHub conversation here

    Here is the relevant code from the ignore.js file in the electron-packager module:

    const DEFAULT_IGNORES = [
      '/node_modules/electron($|/)',
      '/node_modules/electron-prebuilt($|/)',
      '/node_modules/electron-packager($|/)',
      '/\\.git($|/)',
      '/node_modules/\\.bin($|/)',
      '\\.o(bj)?$'
    ]
    

    If you're using .obj files, comment out this the .obj line from the array and you're good to go. I've been doing this for two weeks without consequence on both Windows and Linux machines.