caoxiemeihao / nuxt-electron

Integrate Nuxt and Electron
MIT License
184 stars 21 forks source link

How to generate source map to debug main.ts #52

Closed OndraRehounek closed 10 months ago

OndraRehounek commented 11 months ago

Hi,

we are trying to make JetBrains (or Visual Studio Code) node.js debuggers working with main.ts - is there any option to enable source map to generated main.js file so we can add breakpoints to original TS files?

Of course we tried to enable it in project tsconfig.json but that did not change anything.

Thank you for your time.

HMaker commented 10 months ago

You can pass additional settings to the Vite builder in the nuxt-electron module settings:

export default defineNuxtConfig({
  modules: ['nuxt-electron'],
  electron: {
    build: [
      {
        // Main-Process entry file of the Electron App.
        entry: 'electron/main.ts',
        vite: {
          build: {
            sourcemap: true
          }
        }
      },
    ],
  },
})
HMaker commented 10 months ago

@OndraRehounek how you configured VSCode debugger to properly launch Nuxt with electron?

EDIT: I found it here https://nuxt.com/docs/guide/going-further/debugging#example-vs-code-debug-configuration