vue-cli-plugin-electron-builder icon indicating copy to clipboard operation
vue-cli-plugin-electron-builder copied to clipboard

bakcground.js has no sourcemaps

Open inssitu opened this issue 3 years ago • 6 comments

I am trying to use sentry with the sourcemaps, the rendering works fine but the main process does not work. It seems that no sourcemap is generated for the background.js file, they are only generated for the main.js files.

inssitu avatar Jan 16 '22 03:01 inssitu

Hey,

I haven't properly tested yet, but this seems to generate sourceMaps for background.js

  // vue.config.js
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: (config) => {
        config.devtool('source-map')
      },

nicolas-t avatar Jul 12 '22 18:07 nicolas-t

@nicolas-t Hey, thanks for posting this, I've tried it but it's still not adding source maps for background.js and other scripts included from that one. If it helps here's my vue.config.js file:

const path = require("path");

module.exports = {
  lintOnSave: false,
  transpileDependencies: ["vuetify"],
  pluginOptions: {
    electronBuilder: {
      preload: "src/preload.js",
      externals: ["serialport"],
      outputDir: "builds",
      chainWebpackMainProcess: (config) => {
        config.devtool('source-map')
      },
    },
  },
  configureWebpack: {
    devtool: 'source-map',
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "src/"),
      },
    },
  },
  css: {
    loaderOptions: {
      sass: {
        additionalData: '@import "~@/assets/style/_variables.scss"',
      },
    },
  },
};

Do you have any other suggestions? Thanks in advance if you look into this.

nur557 avatar Jan 20 '23 23:01 nur557

How about https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#enable-sourcemaps?

MatthijsBurgh avatar Jan 21 '23 07:01 MatthijsBurgh

@MatthijsBurgh Thanks for replying. I already have that, you can see in the config I've posted.

nur557 avatar Jan 21 '23 08:01 nur557

This is also what can be found in all Vue docs, so I can't help you further. Good luck.

MatthijsBurgh avatar Jan 21 '23 08:01 MatthijsBurgh

Hey,

I haven't properly tested yet, but this seems to generate sourceMaps for background.js

  // vue.config.js
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: (config) => {
        config.devtool('source-map')
      },

good job

MaskerPRC avatar Dec 22 '23 04:12 MaskerPRC