From 056bc2706c75b4e5ddf7f29fc6d59bb2336b17e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=80=E4=BA=8C?= Date: Mon, 24 Jan 2022 13:33:53 +0800 Subject: [PATCH] chore: format the output so it can be clicked https://github.com/evanw/node-source-map-support/issues/296#issuecomment-1019542193 --- webpack.main.config.js | 7 +++++++ webpack.renderer.config.js | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/webpack.main.config.js b/webpack.main.config.js index 735a31cf..dba7681b 100644 --- a/webpack.main.config.js +++ b/webpack.main.config.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable unicorn/prefer-module */ @@ -40,6 +42,11 @@ module.exports = { alias: webpackAlias, extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'], }, + output: { + devtoolModuleFilenameTemplate: (info) => { + return `file:///${encodeURI(info.absoluteResourcePath)}`; + }, + }, externals: [ // TODO: simply external things will make require can't find things. May need some other way. // nodeExternals({ diff --git a/webpack.renderer.config.js b/webpack.renderer.config.js index 4bffc552..f2eb8299 100644 --- a/webpack.renderer.config.js +++ b/webpack.renderer.config.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-var-requires */ const rules = require('./webpack.rules'); @@ -15,7 +17,13 @@ module.exports = { extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'], fallback: { crypto: false }, }, - output: { chunkFilename: 'main_window/[name].chunk.js', publicPath: '../' }, + output: { + chunkFilename: 'main_window/[name].chunk.js', + publicPath: '../', + devtoolModuleFilenameTemplate: (info) => { + return `file:///${encodeURI(info.absoluteResourcePath)}`; + }, + }, cache: { type: 'filesystem', buildDependencies: {