Skip to content

Not working with webpack minimization  #3

@fwdillema

Description

@fwdillema

Hi,

I made an electron app using electron-forge and its builtin typescript/webpack template, using:

yarn create electron-app my-new-app --template=typescript-webpack

In such a setup, webpack minimizes the javascript code in production mode (but not in development mode). The minimization removes the constructor.name from classes which is used by electron-affinity to retrieve the className of the rpc API (most notably in exposeAPI()). This makes the application fail in production mode as the RPC api is not found by the renderer process (as it is registered with an empty name).

I am not sure whether this can/should be fixed by electron-affinity, but it is good to add this to the documentation to spare other users the time to figure this one out.

I have solved this problem for now by switching off minimization in the webpack configuration file webpack.main.config.js:

optimization: {
minimize: false
},

but that is more a workaround than a proper solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions