From 8fb2bc1ba08ccbe3ea9f2e5017eedf3cd69ce205 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 16 May 2021 14:59:01 +0200 Subject: [PATCH] updated sourcemaps config --- webpack.plugin.config.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/webpack.plugin.config.js b/webpack.plugin.config.js index e59ec4c2..32634e99 100644 --- a/webpack.plugin.config.js +++ b/webpack.plugin.config.js @@ -1,18 +1,27 @@ const path = require('path') +const webpack = require('webpack') const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const bundleAnalyzer = new BundleAnalyzerPlugin({ analyzerPort: 0, }) +const sourceMapOptions = { + exclude: [/node_modules/, /vendor/], + filename: '[file].map', +} + +if (process.env.CI) { + sourceMapOptions.append = '\n//# sourceMappingURL=../../../app.asar.unpacked/assets/webpack/[url]' +} + module.exports = options => { const isDev = !!process.env.TERMINUS_DEV - const devtool = process.env.WEBPACK_DEVTOOL ?? (isDev && process.platform === 'win32' ? 'eval-cheap-module-source-map' : 'cheap-module-source-map') const config = { target: 'node', entry: 'src/index.ts', context: options.dirname, - devtool, + devtool: false, output: { path: path.resolve(options.dirname, 'dist'), filename: 'index.js', @@ -99,7 +108,9 @@ module.exports = options => { /^terminus-/, ...options.externals || [], ], - plugins: [], + plugins: [ + new webpack.SourceMapDevToolPlugin(sourceMapOptions), + ], } if (process.env.PLUGIN_BUNDLE_ANALYZER === options.name) { config.plugins.push(bundleAnalyzer)