I see the issue "ERROR in dll renderer" when installing a package via yarn; solutions in past issues aren't complete or don't work for me.
master branchDEBUG_PROD=true yarn build && yarn start
From readme: git clone --depth 1 --single-branch https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name then cd your-project-name then yarn
yarn add secure-remote-password
Error appears -
ERROR in dll renderer
Module not found: Error: Can't resolve 'secure-remote-password' in '---path---/your-project-name'
@ dll renderer renderer[21]
Just trying to install the module secure-remote-password :)
Removing node_modules does not work (issue here)
This is due how secure-remote-password created as a node module and how the renderer build tries to assemble the bundle.
The problem is, that webpack is right here, you can't really resolve secure-remote-password, because there is no such thing. Just try to require it in plain node repl. Even the docs suggests you should require either secure-remote-password/server or /client. This makes sense as package.json of that package contains no main field, so you can't know what to resolve when someone request the package itself.
If you go to webbpack.config.renderer.dev.dll.babel.js find entry and try this:
entry: {
renderer: [
...Object.keys(dependencies || {}),
'secure-remote-password/client'
].filter(key => key !== 'secure-remote-password')
},
As by default we try to put every package from the root package.json into the renderer's dll bundle. But that is impossible for packages without main field, so we filter out this one, and add a resolvable module.
Please note this is an ugly workaround, not sure how to solve this properly.
We should either preparse dependency key of package.json and filter out mainless packages and show a proper warning or have an other key where you could override such packages how to import them by webpack bundler.
This worked - thanks for replying! Will update if I end up making any of the other changes to fix this dependency issue.
This can also happen if you accidentally put any @types/ packages in your dependencies in package.json instead of devDependencies. Ugh.
Most helpful comment
This can also happen if you accidentally put any
@types/packages in yourdependenciesinpackage.jsoninstead ofdevDependencies. Ugh.