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.

DevDependencies are not removed when packaging app

See original GitHub issue

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.67

Electron version

21.0.1

Operating system

macOS Monterey 12.4

Last known working Electron Forge version

No response

Expected behavior

Expected all devDependencies in package.json to be pruned prior to generating the output from electron-forge make or electron-forge package

Actual behavior

When running electron-forge package on my app, I noticed that the packaged app size is quite large, and none of the devDependencies are pruned.

For example, here’s a list of some of my devDependencies:

    "eslint-config-prettier": "^8.5.0",
    "eslint-import-resolver-typescript": "^3.5.2",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.10",
    "eslint-plugin-react-hooks": "^4.6.0",

After packaging my app, I can see all of these in the out/my_app/.../node_modules folder: image

Steps to reproduce

  1. Create an Electron app
  2. Install some devDependencies (like eslint)
  3. Run electron-forge make

Additional information

Forge config:

  "config": {
    "forge": {
      "packagerConfig": {
        "icon": "./assets/icon",
        "ignore": [
          "src",
          "assets",
          "webpack",
          "public",
          "tsconfig.json",
          ".eslintrc.js",
          ".prettierrc.js",
          "postcss.config.js",
          "prettier.config.js",
          "tailwind.config.js",
          "README.md",
          "LICENSE.md",
          "__previewjs__"
        ]
      },
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "my_app"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
    }
  }

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jordanarldtcommented, Nov 14, 2022

@erikian Ahhh excellent callout. After my last comment I actually was wondering if all of these came from react being in my project. I will do more research and testing to see if I can make sure my app works properly while react-scripts is in the devDependencies. If not, I guess it’s not a huge deal. Just trying to keep my project as lightweight as possible!

0reactions
erickzhaocommented, Nov 14, 2022

Seems like this is resolved. Closing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Packaging with all dependencies/devDependencies removed ...
I am developing an Electron app using Quasar framework . Due to restrictions, my node_modules are static (not allowed to download anything ...
Read more >
ng packagr does not remove devDependencies · Issue #1028
ng-packagr copies devDependencies to the final package.json even though they are not whitelisted. i have angular in peerDependencies and ...
Read more >
Workspace npm dependencies - Angular
The Angular Framework, Angular CLI, and components used by Angular applications are packaged as npm packages and distributed using the npm registry.
Read more >
The difference between dependencies and devDependencies ...
"devDependencies" are required to develop and build your app, but are not needed to run the final version that customers will use. For...
Read more >
Is this a dependency or devDependency? - With Blue Ink
Installing all packages (including devDependencies) in a production server is an easy way to remove many “it works on my machine”-like issues ...
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