MarshallOfSound / electron-devtools-installer

An easy way to ensure Chrome DevTools extensions into Electron
MIT License
1.11k stars 136 forks source link

Sourcemap errors when compiled with Webpack #201

Closed goosewobbler closed 2 years ago

goosewobbler commented 2 years ago

Compiling this extension in my webpack build produces sourceMap errors like the following:

Failed to parse source map from '/project/node_modules/.pnpm/electron-devtools-installer@3.2.0/node_modules/electron-devtools-installer/src/downloadChromeExtension.ts' file: Error: ENOENT: no such file or directory, open '/project/node_modules/.pnpm/electron-devtools-installer@3.2.0/node_modules/electron-devtools-installer/src/downloadChromeExtension.ts'

This stems from the bundled .map files pointing to the (not bundled) src directory:

"sources":["../src/downloadChromeExtension.ts"]

Do we actually need source maps in the NPM package? Or is this an issue with my webpack conf?

goosewobbler commented 2 years ago

Changed source-map-loader webpack config to ignore node_modules, which fixed it:

{
      enforce: 'pre',
      exclude: /node_modules/,
      test: /\.js$/,
      loader: 'source-map-loader',
}