Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit e1fc92d

Browse files
committed
feat: support hidden source maps to map error stack traces from crash reports
1 parent b5fd066 commit e1fc92d

File tree

5 files changed

+263
-144
lines changed

5 files changed

+263
-144
lines changed

Diff for: templates/webpack.angular.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = env => {
4747
uglify, // --env.uglify
4848
report, // --env.report
4949
sourceMap, // --env.sourceMap
50+
hiddenSourceMap, // --env.hiddenSourceMap
5051
hmr, // --env.hmr,
5152
unitTesting, // --env.unitTesting
5253
} = env;
@@ -96,6 +97,13 @@ module.exports = env => {
9697
additionalLazyModuleResources: additionalLazyModuleResources
9798
});
9899

100+
let sourceMapFilename = "[file].map";
101+
if (typeof hiddenSourceMap === "string") {
102+
sourceMapFilename = join(relative(dist, __dirname), hiddenSourceMap, "[file].map");
103+
} else if (typeof hiddenSourceMap === "boolean" && !!hiddenSourceMap) {
104+
sourceMapFilename = join(relative(dist, __dirname), "sourceMap", "[file].map");
105+
}
106+
99107
const config = {
100108
mode: uglify ? "production" : "development",
101109
context: appFullPath,
@@ -112,6 +120,7 @@ module.exports = env => {
112120
output: {
113121
pathinfo: false,
114122
path: dist,
123+
sourceMapFilename,
115124
libraryTarget: "commonjs2",
116125
filename: "[name].js",
117126
globalObject: "global",
@@ -142,7 +151,7 @@ module.exports = env => {
142151
"fs": "empty",
143152
"__dirname": false,
144153
},
145-
devtool: sourceMap ? "inline-source-map" : "none",
154+
devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"),
146155
optimization: {
147156
runtimeChunk: "single",
148157
splitChunks: {
@@ -164,7 +173,7 @@ module.exports = env => {
164173
new UglifyJsPlugin({
165174
parallel: true,
166175
cache: true,
167-
sourceMap: !!sourceMap,
176+
sourceMap: !!sourceMap || !!hiddenSourceMap,
168177
uglifyOptions: {
169178
output: {
170179
comments: false,

0 commit comments

Comments
 (0)