diego3g / electron-typescript-react

:electron: An Electron boilerplate including TypeScript, React, Jest and ESLint.
1.45k stars 295 forks source link

Include assets folder to webpack ? #18

Closed HenriqueDerosa closed 3 years ago

HenriqueDerosa commented 4 years ago

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(.

lucasdeosantana commented 4 years ago

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

HenriqueDerosa commented 4 years ago

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? 😁

edermariano commented 3 years ago

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

diego3g commented 3 years ago

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