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.

How to specify which files you want to bundle?

See original GitHub issue
  • Version: 19.52.1
  • Target: Mac

I’m building an application using React and SASS. In this application I’m also using ES6/ES7 features. To compile all of my code to distribution ready code I’m using Webpack in combination with Babel.

Now I’m trying to use electron-builder to package my Electron app. This works, but when opening the application I get the following error:

screen shot 2018-01-04 at 16 41 57

I know this is because Electron can’t handle ES6/ES7 which is fine. That’s why I’m using Babel to compile to ES5. Electron-builder isn’t using these compiles assets tho.

These are the contents of my package.json (I’ve removed the unnecessary stuff):

{
  "main": "src/index.js",
  "build": {
    "appId": "your.id",
    "mac": {
      "category": "your.app.category.type"
    }
  },
  "scripts": {
    "start": "npm run build:dev",
    "start:electron": "./node_modules/.bin/electron src/electron.js",
    "build:dev": "BABEL_ENV=dev node_modules/.bin/webpack-dev-server --env=dev",
    "build:prod": "BABEL_ENV=prod node_modules/.bin/webpack --env=prod",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "postinstall": "electron-builder install-app-deps"
  },
  "devDependencies": {
  },
  "dependencies": {
  }
}

So my question is: it is possible to bundle compiled assets? I’ve the index.html, app.min.js and app.min.css files in my dist folder. How do I specify that I want to use these files for my Electron app?

If you need any more information don’t hesitate to ask. Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

9reactions
daviddelusenetcommented, Jan 8, 2018

This was actually quite easy to solve:

"main": "src/electron.js",
"build": {
  "appId": "your.id",
  "mac": {
    "category": "public.app-category.video"
  },
  "files": [
    "src/electron.js",
    "dist/index.html",
    "dist/app.min.js",
    "dist/app.min.css"
  ]
}

Closing this issue.

0reactions
ishandutta2007commented, Jul 4, 2018

This is how my root directory structure: THe *.py files are not loading

index.html
styles.css
main.js
package.json
dist/
node_modules/
renderer.js
visitor.py
download.py
Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify a File Bundle - Pants
All files in the src/main/resources directory are recursively included. · All files in the config directory are included, except any .xml files. ·...
Read more >
Adding files to the bundle - IBM
Right-click the project in the Navigator tree, then click IBM Tivoli Monitoring Remote Deploy > Add Files to Bundle. Both of these actions...
Read more >
7.12 Git Tools - Bundling
Now you have a file named repo.bundle that has all the data needed to re-create the repository's master branch. With the bundle command...
Read more >
Bundle | Apple Developer Documentation
You don't use a bundle object to locate files in a container directory or in other ... these modifiers when specifying the name...
Read more >
bundletool - Android Developers
If you want to deploy the APKs to a device, you also need to include ... You can then pass the file to...
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