Use file source maps in production
There was a bug in Chrome which prevented the Chrome Dev Tools from
loading source map files for extension scripts.
This CL changes the webpack configuration file to produce source map
files instead of inlining them in scripts directly, since this reduces
the built ZIP size by at least 25% and the bug has been fixed in
Chrome 99.
Fixed: twpowertools:90
Change-Id: I7b31585db0fea2235d963053cbe8f3d3ecc2b4ea
diff --git a/templates/manifest.gjson b/templates/manifest.gjson
index 96c0658..2524612 100644
--- a/templates/manifest.gjson
+++ b/templates/manifest.gjson
@@ -81,7 +81,20 @@
"css/thread_list_avatars.css",
"css/autorefresh_list.css",
"css/image_max_height.css",
- "css/extrainfo.css"
+ "css/extrainfo.css",
+
+ "communityConsoleMain.bundle.js.map",
+ "communityConsoleStart.bundle.js.map",
+ "publicForum.bundle.js.map",
+ "publicThread.bundle.js.map",
+ "profile.bundle.js.map",
+ "profileIndicator.bundle.js.map",
+ "profileIndicatorInject.bundle.js.map",
+ "batchLockInject.bundle.js.map",
+ "xhrInterceptorInject.bundle.js.map",
+ "extraInfoInject.bundle.js.map",
+ "optionsCommon.bundle.js.map",
+ "mdcStyles.bundle.js.map"
#if defined(CHROMIUM_MV3)
],
"matches": [
diff --git a/webpack.config.js b/webpack.config.js
index c8c3fcc..6024eb4 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -35,6 +35,8 @@
};
module.exports = (env, args) => {
+ // NOTE: When adding an entry, add the corresponding source map file to
+ // web_accessible_resources in //templates/manifest.gjson.
let entry = {
// Content scripts
communityConsoleMain: './src/contentScripts/communityConsole/main.js',
@@ -120,10 +122,7 @@
}),
...getCopyPluginsForOverridenLocales(outputPath),
],
- // NOTE: Change to
- // (args.mode == 'production' ? 'source-map' : 'inline-source-map')
- // once https://crbug.com/212374 is fixed.
- devtool: 'inline-source-map',
+ devtool: (args.mode == 'production' ? 'source-map' : 'inline-source-map'),
module: {
rules: [
{