question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignoring native build directories not working during packaging

See original GitHub issue

Please describe your issue:

I m not able to ignore some directories when packaging the app. I m using sqlite3 module and it’ll generate intermediate build directory in node_modules\sqlite3\build path, it is be around 25MB which I don’t want to part of the app. Can shave ~25MB of the total app size.

I m ignoring using electronPackagerConfig.ignore, like below:

"electronPackagerConfig" : {
    "ignore": [
        ".vscode",
        "node_modules/sqlite3/build"
    ]
}

But it seems, the electron-package is running before the native build and thus above ignore is of no use. I’ve seen this behavior by checking the %temp%\electron-package\ directory where the packaging is happening.

To prove the above, .vscode directory is not included in the app.asar as I’ve it in the ignore list. And similarly, if I use node_modules/sqlite3, then the complete sqlite3 directory is not getting bundled and then I m getting native build failed error which is expected.

Is this the expected order (first package, then build)? If this is the expected order, how to ignore directories which will be created during the native builds?

config.forge data in package.json:

"forge": {
    "make_targets": {
        "win32": ["squirrel"],
        "darwin": ["zip"],
        "linux": ["deb","rpm"]
    },
    "electronPackagerConfig": {
        "ignore": [
            ".vscode",
            "node_modules/sqlite3/build"
        ]
    },
    "electronWinstallerConfig": {
        "name": "electron_forge_demo"
    },
    "electronInstallerDebian": {},
    "electronInstallerRedhat": {}
}

Repro repo: https://github.com/manikantag/electron-forge-native-binaries-issue

Generate package: npm run package Verify if sqlite3/build is present or not: asar l app.asar | grep build

OS details: Windows 8.1 x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MarshallOfSoundcommented, Jan 24, 2017

But it seems, the electron-package is running before the native build and thus above ignore is of no use.

This is accurate, you need to use an afterCopy hook to delete the artifacts you don’t want from the native module build process.

/cc @malept I don’t think we should do this ^^ by default as some people may want the debug artifacts. What do you think?

0reactions
manikantagcommented, Jan 24, 2017

With 2.7.3, it is working with relative paths. Pretty quick fix! Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring native build directories not working during packaging
Please describe your issue: I m not able to ignore some directories when packaging the app. I m using sqlite3 module and it'll...
Read more >
How to make Metro (React Native packager) ignore certain ...
In your project root create rn-cli.config.js with the contents: const blacklist = require('metro-bundler').createBlacklist; module.exports = { getBlacklistRE: ...
Read more >
patch-package - npm
Fix broken node modules with no fuss. Latest version: 6.5.0, ... Start using patch-package in your project by running `npm i patch-package`.
Read more >
find_package — CMake 3.25.1 Documentation
New in version 3.24: All calls to find_package() (even in Module mode) first look for a config package file in the CMAKE_FIND_PACKAGE_REDIRECTS_DIR directory....
Read more >
Failed Builds - Visual Studio App Center - Microsoft Learn
If building works locally but not in App Center. Usually this problem is because of uncommitted files, different tooling, or unrestored ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found