Generate sourcemaps for WoltLabSuite.Core bundles
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 30 Apr 2021 10:17:45 +0000 (12:17 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 12 May 2021 13:10:19 +0000 (15:10 +0200)
extra/_buildCore.js
wcfsetup/install/files/js/require.build.js

index 4abc243da3670ef39c43bc481c4890faf3d7a389..e4e7d7af7ddc61a06c74e673f52cb22424af42ad 100644 (file)
@@ -86,8 +86,20 @@ async function compile(destination, files, overrides) {
                                        cwd: process.cwd(),
                                        stdio: [0, 1, 2],
                                });
-                               const output = await compiler.compile(fs.readFileSync(outFilename, "utf-8"));
+                               const sourceMap = JSON.parse(fs.readFileSync(`${outFilename}.map`, "utf-8"));
+
+                               const output = await compiler.compile(
+                                       fs.readFileSync(outFilename, "utf-8"),
+                                       {
+                                               sourceMap: {
+                                                       content: JSON.stringify(sourceMap),
+                                                       url: `${outFilename}.map`,
+                                                       includeSources: true,
+                                               }
+                                       }
+                               );
                                fs.writeFileSync(outFilename, output.code);
+                               fs.writeFileSync(`${outFilename}.map`, output.map);
                        }
                        console.timeEnd(outFilename);
                }
index 263e5c51f52c8c31c4e874bab691035d9667b65f..b4a785e40d75e5298c11287fb0bd363d459463da 100644 (file)
@@ -3,6 +3,7 @@
                mainConfigFile: 'require.config.js',
                name: "WoltLabSuite/_Meta",
                out: "WoltLabSuite.Core.min.js",
+               generateSourceMaps: true,
                useStrict: true,
                preserveLicenseComments: false,
                optimize: 'none',