diego3g/electron-typescript-react

Include assets folder to webpack ?

HenriqueDerosa opened this issue · 4 comments

It seems we must add an assets folder to the webpack ?
It is trying to find it inside dist folder.

Error

Implementing the tray icon I got the following error.

Uncaught Exception:
TypeError: Error processing argument at index 0, conversion failure from /Users..../dist/assets/icon-dark.png at App.<anonymous>

And then indicates a line in dist/main.js when I add the path to new Tray(.

I have the same problem, did you find a solution?

Nope. For development yes, I could use __dirname, '..', 'assets', 'icon-file to give the location when running it locally, but if I create a package it does not find the file.
There might be other workarounds, but it seems it should be set in webpack. Unfortunately I don't know much about webpack. Let's call the masters 👉🏻 @diego3g can you help us? 😁

Something that maybe could work is to use build.extraFiles something like this:

"build": {
    "extraFiles": [
      {
        "from": "path/of/you/assets",
        "to": "Resources/assets",
        "filter": [
          "**/*"
        ]
      }
    ]
  }

in your package.json

Fixed in 6acba3b, now we have an assets folder and it's included inside webpack and final package.