saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.97k stars 229 forks source link

How to get source maps of main process for Sentry ? #227

Closed TheJohnPython closed 2 years ago

TheJohnPython commented 2 years ago

Hi! I'm using Sentry for bug tracking. I connected renderer process to Sentry, generated source maps with nextjs productionBrowserSourceMaps: true then uploaded source files (.js and .js.map) to Sentry with CLI command: sentry-cli releases files $RELEASE_VERSION upload-sourcemaps ./.next -x .js -x .map --validate --verbose --rewrite --url-prefix 'app://./_next' That works!

Now i want do the same thing for main process, but my source code is in /dist/win-unpacked/resources/app.asar, how can i get .js and .js.map files of main process after build to upload it to Sentry?

lacymorrow commented 2 years ago

This question should probably be directed to the Electron team, since it is not specific to Nextron

TheJohnPython commented 2 years ago

Think is not electron specificity, but this is nextron config specifity.

If i am using custom configuration with electron + webpack + electron-builder, it contains the following steps:

  1. Build bundle.js (and source maps) with webpack
  2. after apply electron-builder with entry point bundle.js

When i am using nextron, i have only nextron build command, which does the same steps by one command. How can i customize this? If i try change config.output in nextron.config.js:

 webpack: (config) => {
    config.output = {
      ...config.output,
      path: path.join(__dirname, 'dist'),
      filename: 'bundle.js',
    };
}

i got next error:

• writing effective config file=dist\builder-effective-config.yaml • rebuilding native dependencies dependencies=leveldown@5.6.0 platform=win32 arch=x64 • packaging platform=win32 arch=x64 electron=15.3.3 appOutDir=dist\win-unpacked ⨯ Application entry file "dist\bundle.js" in the "C:\electron-application\app\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration. failedTask=build stackTrace=Error: Application entry file "dist\bundle.js" in t he "C:\electron-application\app\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.

TheJohnPython commented 2 years ago

Found all the necessary files in the folder "app". Issue can be closed

rinalditomas commented 1 year ago

Found all the necessary files in the folder "app". Issue can be closed

Hey @TheJohnPython could you explain how did you upload the source maps for the main process? Thanks!