Open zac-jacobson opened 2 years ago
Can concur that source-maps are not respected in error outputs despite the fact that they look like they are being generated in the file system.
E.g in the case of
⠴ Compiling Renderer CodeIssues checking in progress...
⠙ Compiling Renderer CodeApp threw an error during load
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.join (node:path:1172:7)
at Object../src/main/data/local/appStorage.ts (/home-dir/.webpack/main/index.js:53234:15)
at __webpack_require__ (/home-dir/.webpack/main/index.js:58123:42)
at Object../src/main/handlers/storyHandlers.ts (/home-dir/.webpack/main/index.js:53692:20)
at __webpack_require__ (/home-dir/.webpack/main/index.js:58123:42)
at Object../src/main/helpers/mainUtils.ts (/home-dir/.webpack/main/index.js:54124:23)
at __webpack_require__ (/home-dir/.webpack/main/index.js:58123:42)
at Object../src/main/index.ts (/home-dir/.webpack/main/index.js:54411:19)
There exists a /home-dir/.webpack/main/index.js.map
, but it is ignored in this stack trace.
I also have this problem. This is what I have tried without success:
Installed npm install --save-dev source-map-support
In Index.ts:
if (process.env.NODE_ENV === 'development') {
require('source-map-support').install();
}
forge.config.ts:
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig: {
...mainConfig,
devtool: 'source-map',
},
renderer: {
config: {
...rendererConfig,
devtool: 'source-map',
},
entryPoints: [
{
html: './src/index.html',
js: './src/app.tsx',
name: 'main_window',
preload: {
js: './src/preload.ts',
},
},
],
},
}),
],
tsconfig.json:
{
"compilerOptions": {
"sourceMap": true,
...
}
}
Pre-flight checklist
Electron Forge version
6.0.0-beta.61
Electron version
v15.1.2
Operating system
Windows 10 (19042.1320)
Last known working Electron Forge version
No response
Expected behavior
We have been troubleshooting some problems with our app, but the error stack traces are not accurately reflecting where in the code the errors occurred, which makes troubleshooting difficult.
When an error is thrown in our electron app, we would expect the
stack
attribute of that error to correctly point to the place in the webpack-generated index.js file, be it for main or renderer.And when
packagerConfig.asar: false
, thatstack
attribute does point to the spot in the code where an error is created.Actual behavior
If
packagerConfig.asar: true
, the location given in the error'sstack
do not line up in the generated index.js with where the error was created.Steps to reproduce
We are setting
webpack.devtool: "source-map"
I include a line during app initialization to print out a stack trace, just to see what is going on, just to show that this is not an issue with our error reporting module:
running the make process and comparing the logged error's stack locations with the generated webpack artifacts, it does not point at the correct place when
packagerConfig.asar: true
Additional information
forge.config.js