Preserve Uglify source maps in production (#103)

This commit is contained in:
Nolan Lawson 2018-04-13 20:17:36 -07:00 committed by GitHub
parent fdcf2bc46b
commit 9030a24d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 103 additions and 53 deletions

137
package-lock.json generated
View File

@ -1487,7 +1487,7 @@
"move-concurrently": "1.0.1", "move-concurrently": "1.0.1",
"promise-inflight": "1.0.1", "promise-inflight": "1.0.1",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"ssri": "5.2.4", "ssri": "5.3.0",
"unique-filename": "1.1.0", "unique-filename": "1.1.0",
"y18n": "4.0.0" "y18n": "4.0.0"
}, },
@ -3542,9 +3542,9 @@
"integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=" "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I="
}, },
"flush-write-stream": { "flush-write-stream": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.2.tgz", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz",
"integrity": "sha1-yBuQ2HRnZvGmCaRoCZRsRd2K5Bc=", "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==",
"requires": { "requires": {
"inherits": "2.0.3", "inherits": "2.0.3",
"readable-stream": "2.3.3" "readable-stream": "2.3.3"
@ -6175,7 +6175,7 @@
"concat-stream": "1.6.0", "concat-stream": "1.6.0",
"duplexify": "3.5.4", "duplexify": "3.5.4",
"end-of-stream": "1.4.1", "end-of-stream": "1.4.1",
"flush-write-stream": "1.0.2", "flush-write-stream": "1.0.3",
"from2": "2.3.0", "from2": "2.3.0",
"parallel-transform": "1.1.0", "parallel-transform": "1.1.0",
"pump": "2.0.1", "pump": "2.0.1",
@ -7801,6 +7801,17 @@
"duplexify": "3.5.4", "duplexify": "3.5.4",
"inherits": "2.0.3", "inherits": "2.0.3",
"pump": "2.0.1" "pump": "2.0.1"
},
"dependencies": {
"pump": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
"integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
"requires": {
"end-of-stream": "1.4.1",
"once": "1.4.0"
}
}
} }
}, },
"punycode": { "punycode": {
@ -8273,6 +8284,11 @@
"onetime": "1.1.0" "onetime": "1.1.0"
} }
}, },
"ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg=="
},
"right-align": { "right-align": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@ -8332,6 +8348,14 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
}, },
"safe-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"requires": {
"ret": "0.1.15"
}
},
"sanitize-filename": { "sanitize-filename": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.1.tgz", "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.1.tgz",
@ -9209,9 +9233,9 @@
} }
}, },
"ssri": { "ssri": {
"version": "5.2.4", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.2.4.tgz", "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
"integrity": "sha512-UnEAgMZa15973iH7cUi0AHjJn1ACDIkaMyZILoqwN6yzt+4P81I8tBc5Hl+qwi5auMplZtPQsHrPBR5vJLcQtQ==", "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==",
"requires": { "requires": {
"safe-buffer": "5.1.1" "safe-buffer": "5.1.1"
} }
@ -10351,9 +10375,9 @@
"optional": true "optional": true
}, },
"uglifyjs-webpack-plugin": { "uglifyjs-webpack-plugin": {
"version": "1.2.3", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.3.tgz", "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.4.tgz",
"integrity": "sha512-as/50351uuJGiQbhVvE510SCqM/YOWghCzIFJeEOu5oVE0QOZ3/vu2QcnVvu0Lz+vNd0rKsiCFAlbcw0i/YH2w==", "integrity": "sha512-z0IbjpW8b3O/OVn+TTZN4pI29RN1zktFBXLIzzfZ+++cUtZ1ERSlLWgpE/5OERuEUs1ijVQnpYAkSlpoVmQmSQ==",
"requires": { "requires": {
"cacache": "10.0.4", "cacache": "10.0.4",
"find-cache-dir": "1.0.0", "find-cache-dir": "1.0.0",
@ -10366,13 +10390,14 @@
}, },
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "6.2.1", "version": "6.4.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.2.1.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz",
"integrity": "sha1-KKarxJOiq+D7TIUHrK7bQ/pVBnE=", "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=",
"requires": { "requires": {
"fast-deep-equal": "1.0.0", "fast-deep-equal": "1.0.0",
"fast-json-stable-stringify": "2.0.0", "fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1" "json-schema-traverse": "0.3.1",
"uri-js": "3.0.2"
} }
}, },
"commander": { "commander": {
@ -10385,7 +10410,7 @@
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==",
"requires": { "requires": {
"ajv": "6.2.1", "ajv": "6.4.0",
"ajv-keywords": "3.1.0" "ajv-keywords": "3.1.0"
} }
}, },
@ -10806,13 +10831,13 @@
"dev": true "dev": true
}, },
"webpack": { "webpack": {
"version": "4.1.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.1.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.5.0.tgz",
"integrity": "sha512-ZFYcAZ44kOT+xsS5MS2H1fQr0PJkwQdYem/d17wacDkkupzsAkBJ3hDShWHdPVvWluFs6pfhHWw/dVso1m0rsA==", "integrity": "sha512-6GrZsvQJnG7o7mjbfjp6s5CyMfdopjt1A/X8LcYwceis9ySjqBX6Lusso2wNZ06utHj2ZvfL6L3f7hfgVeJP6g==",
"requires": { "requires": {
"acorn": "5.3.0", "acorn": "5.3.0",
"acorn-dynamic-import": "3.0.0", "acorn-dynamic-import": "3.0.0",
"ajv": "6.2.1", "ajv": "6.4.0",
"ajv-keywords": "3.1.0", "ajv-keywords": "3.1.0",
"chrome-trace-event": "0.1.2", "chrome-trace-event": "0.1.2",
"enhanced-resolve": "4.0.0", "enhanced-resolve": "4.0.0",
@ -10820,59 +10845,45 @@
"loader-runner": "2.3.0", "loader-runner": "2.3.0",
"loader-utils": "1.1.0", "loader-utils": "1.1.0",
"memory-fs": "0.4.1", "memory-fs": "0.4.1",
"micromatch": "3.1.9", "micromatch": "3.1.10",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"neo-async": "2.5.0", "neo-async": "2.5.0",
"node-libs-browser": "2.1.0", "node-libs-browser": "2.1.0",
"schema-utils": "0.4.5", "schema-utils": "0.4.5",
"tapable": "1.0.0", "tapable": "1.0.0",
"uglifyjs-webpack-plugin": "1.2.3", "uglifyjs-webpack-plugin": "1.2.4",
"watchpack": "1.5.0", "watchpack": "1.5.0",
"webpack-sources": "1.1.0" "webpack-sources": "1.1.0"
}, },
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "6.2.1", "version": "6.4.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.2.1.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz",
"integrity": "sha1-KKarxJOiq+D7TIUHrK7bQ/pVBnE=", "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=",
"requires": { "requires": {
"fast-deep-equal": "1.0.0", "fast-deep-equal": "1.0.0",
"fast-json-stable-stringify": "2.0.0", "fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1" "json-schema-traverse": "0.3.1",
"uri-js": "3.0.2"
} }
}, },
"ajv-keywords": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.1.0.tgz",
"integrity": "sha1-rCsnk5xUPpXSwG5/f1wnvkqlQ74="
},
"braces": { "braces": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
"requires": { "requires": {
"arr-flatten": "1.1.0", "arr-flatten": "1.1.0",
"array-unique": "0.3.2", "array-unique": "0.3.2",
"define-property": "1.0.0",
"extend-shallow": "2.0.1", "extend-shallow": "2.0.1",
"fill-range": "4.0.0", "fill-range": "4.0.0",
"isobject": "3.0.1", "isobject": "3.0.1",
"kind-of": "6.0.2",
"repeat-element": "1.1.2", "repeat-element": "1.1.2",
"snapdragon": "0.8.1", "snapdragon": "0.8.1",
"snapdragon-node": "2.1.1", "snapdragon-node": "2.1.1",
"split-string": "3.1.0", "split-string": "3.1.0",
"to-regex": "3.0.1" "to-regex": "3.0.2"
}, },
"dependencies": { "dependencies": {
"define-property": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
"requires": {
"is-descriptor": "1.0.2"
}
},
"extend-shallow": { "extend-shallow": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
@ -10940,13 +10951,13 @@
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
}, },
"micromatch": { "micromatch": {
"version": "3.1.9", "version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.9.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-SlIz6sv5UPaAVVFRKodKjCg48EbNoIhgetzfK/Cy0v5U52Z6zB136M8tp0UC9jM53LYbmIRihJszvvqpKkfm9g==", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
"requires": { "requires": {
"arr-diff": "4.0.0", "arr-diff": "4.0.0",
"array-unique": "0.3.2", "array-unique": "0.3.2",
"braces": "2.3.1", "braces": "2.3.2",
"define-property": "2.0.2", "define-property": "2.0.2",
"extend-shallow": "3.0.2", "extend-shallow": "3.0.2",
"extglob": "2.0.4", "extglob": "2.0.4",
@ -10956,7 +10967,7 @@
"object.pick": "1.3.0", "object.pick": "1.3.0",
"regex-not": "1.0.0", "regex-not": "1.0.0",
"snapdragon": "0.8.1", "snapdragon": "0.8.1",
"to-regex": "3.0.1" "to-regex": "3.0.2"
} }
}, },
"nanomatch": { "nanomatch": {
@ -10975,7 +10986,7 @@
"object.pick": "1.3.0", "object.pick": "1.3.0",
"regex-not": "1.0.0", "regex-not": "1.0.0",
"snapdragon": "0.8.1", "snapdragon": "0.8.1",
"to-regex": "3.0.1" "to-regex": "3.0.2"
} }
}, },
"schema-utils": { "schema-utils": {
@ -10983,9 +10994,31 @@
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==",
"requires": { "requires": {
"ajv": "6.2.1", "ajv": "6.4.0",
"ajv-keywords": "3.1.0" "ajv-keywords": "3.1.0"
} }
},
"to-regex": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
"integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
"requires": {
"define-property": "2.0.2",
"extend-shallow": "3.0.2",
"regex-not": "1.0.2",
"safe-regex": "1.1.0"
},
"dependencies": {
"regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
"integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
"requires": {
"extend-shallow": "3.0.2",
"safe-regex": "1.1.0"
}
}
}
} }
} }
}, },

View File

@ -73,8 +73,9 @@
"svgo": "^1.0.3", "svgo": "^1.0.3",
"timeago.js": "^3.0.2", "timeago.js": "^3.0.2",
"tiny-queue": "^0.2.1", "tiny-queue": "^0.2.1",
"uglifyjs-webpack-plugin": "^1.2.4",
"web-animations-js": "^2.3.1", "web-animations-js": "^2.3.1",
"webpack": "^4.1.0", "webpack": "^4.5.0",
"webpack-bundle-analyzer": "^2.11.1", "webpack-bundle-analyzer": "^2.11.1",
"workerize-loader": "^1.0.1", "workerize-loader": "^1.0.1",
"yargs": "^10.1.1" "yargs": "^10.1.1"

View File

@ -2,6 +2,7 @@ const webpack = require('webpack')
const config = require('sapper/webpack/config.js') const config = require('sapper/webpack/config.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin') const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
const UglifyWebpackPlugin = require('uglifyjs-webpack-plugin')
const isDev = config.dev const isDev = config.dev
@ -46,6 +47,21 @@ module.exports = {
node: { node: {
setImmediate: false setImmediate: false
}, },
optimization: {
minimizer: isDev ? [] : [new UglifyWebpackPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
ecma: 6,
mangle: true,
compress: true,
output: {
comments: false
}
}
})]
},
plugins: [ plugins: [
new LodashModuleReplacementPlugin({ new LodashModuleReplacementPlugin({
collections: true, collections: true,