mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(electron): sourcemap not loading for electron dev mode (#9951)
This commit is contained in:
@@ -432,6 +432,21 @@ export function createWebpackConfig(
|
||||
if (buildConfig.isElectron) {
|
||||
config.plugins.push(createShellHTMLPlugin(flags, buildConfig));
|
||||
config.plugins.push(createBackgroundWorkerHTMLPlugin(flags, buildConfig));
|
||||
|
||||
// sourcemap url like # sourceMappingURL=76-6370cd185962bc89.js.map wont load in electron
|
||||
// this is because the default file:// protocol will be ignored by Chromium
|
||||
// so we need to replace the sourceMappingURL to assets:// protocol
|
||||
// for example:
|
||||
// replace # sourceMappingURL=76-6370cd185962bc89.js.map
|
||||
// to # sourceMappingURL=assets://./{dir}/76-6370cd185962bc89.js.map
|
||||
config.plugins.push(
|
||||
new webpack.SourceMapDevToolPlugin({
|
||||
append: pathData => {
|
||||
return `\n//# sourceMappingURL=assets://./${pathData.filename}.map`;
|
||||
},
|
||||
filename: '[file].map',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
|
||||
Reference in New Issue
Block a user