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",
"promise-inflight": "1.0.1",
"rimraf": "2.6.2",
"ssri": "5.2.4",
"ssri": "5.3.0",
"unique-filename": "1.1.0",
"y18n": "4.0.0"
},
@ -3542,9 +3542,9 @@
"integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I="
},
"flush-write-stream": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.2.tgz",
"integrity": "sha1-yBuQ2HRnZvGmCaRoCZRsRd2K5Bc=",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz",
"integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==",
"requires": {
"inherits": "2.0.3",
"readable-stream": "2.3.3"
@ -6175,7 +6175,7 @@
"concat-stream": "1.6.0",
"duplexify": "3.5.4",
"end-of-stream": "1.4.1",
"flush-write-stream": "1.0.2",
"flush-write-stream": "1.0.3",
"from2": "2.3.0",
"parallel-transform": "1.1.0",
"pump": "2.0.1",
@ -7801,6 +7801,17 @@
"duplexify": "3.5.4",
"inherits": "2.0.3",
"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": {
@ -8273,6 +8284,11 @@
"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": {
"version": "0.1.3",
"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",
"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": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.1.tgz",
@ -9209,9 +9233,9 @@
}
},
"ssri": {
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.2.4.tgz",
"integrity": "sha512-UnEAgMZa15973iH7cUi0AHjJn1ACDIkaMyZILoqwN6yzt+4P81I8tBc5Hl+qwi5auMplZtPQsHrPBR5vJLcQtQ==",
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
"integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==",
"requires": {
"safe-buffer": "5.1.1"
}
@ -10351,9 +10375,9 @@
"optional": true
},
"uglifyjs-webpack-plugin": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.3.tgz",
"integrity": "sha512-as/50351uuJGiQbhVvE510SCqM/YOWghCzIFJeEOu5oVE0QOZ3/vu2QcnVvu0Lz+vNd0rKsiCFAlbcw0i/YH2w==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.4.tgz",
"integrity": "sha512-z0IbjpW8b3O/OVn+TTZN4pI29RN1zktFBXLIzzfZ+++cUtZ1ERSlLWgpE/5OERuEUs1ijVQnpYAkSlpoVmQmSQ==",
"requires": {
"cacache": "10.0.4",
"find-cache-dir": "1.0.0",
@ -10366,13 +10390,14 @@
},
"dependencies": {
"ajv": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.2.1.tgz",
"integrity": "sha1-KKarxJOiq+D7TIUHrK7bQ/pVBnE=",
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz",
"integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=",
"requires": {
"fast-deep-equal": "1.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": {
@ -10385,7 +10410,7 @@
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==",
"requires": {
"ajv": "6.2.1",
"ajv": "6.4.0",
"ajv-keywords": "3.1.0"
}
},
@ -10806,13 +10831,13 @@
"dev": true
},
"webpack": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.1.0.tgz",
"integrity": "sha512-ZFYcAZ44kOT+xsS5MS2H1fQr0PJkwQdYem/d17wacDkkupzsAkBJ3hDShWHdPVvWluFs6pfhHWw/dVso1m0rsA==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.5.0.tgz",
"integrity": "sha512-6GrZsvQJnG7o7mjbfjp6s5CyMfdopjt1A/X8LcYwceis9ySjqBX6Lusso2wNZ06utHj2ZvfL6L3f7hfgVeJP6g==",
"requires": {
"acorn": "5.3.0",
"acorn-dynamic-import": "3.0.0",
"ajv": "6.2.1",
"ajv": "6.4.0",
"ajv-keywords": "3.1.0",
"chrome-trace-event": "0.1.2",
"enhanced-resolve": "4.0.0",
@ -10820,59 +10845,45 @@
"loader-runner": "2.3.0",
"loader-utils": "1.1.0",
"memory-fs": "0.4.1",
"micromatch": "3.1.9",
"micromatch": "3.1.10",
"mkdirp": "0.5.1",
"neo-async": "2.5.0",
"node-libs-browser": "2.1.0",
"schema-utils": "0.4.5",
"tapable": "1.0.0",
"uglifyjs-webpack-plugin": "1.2.3",
"uglifyjs-webpack-plugin": "1.2.4",
"watchpack": "1.5.0",
"webpack-sources": "1.1.0"
},
"dependencies": {
"ajv": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.2.1.tgz",
"integrity": "sha1-KKarxJOiq+D7TIUHrK7bQ/pVBnE=",
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz",
"integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=",
"requires": {
"fast-deep-equal": "1.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": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz",
"integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==",
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
"requires": {
"arr-flatten": "1.1.0",
"array-unique": "0.3.2",
"define-property": "1.0.0",
"extend-shallow": "2.0.1",
"fill-range": "4.0.0",
"isobject": "3.0.1",
"kind-of": "6.0.2",
"repeat-element": "1.1.2",
"snapdragon": "0.8.1",
"snapdragon-node": "2.1.1",
"split-string": "3.1.0",
"to-regex": "3.0.1"
"to-regex": "3.0.2"
},
"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": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
@ -10940,13 +10951,13 @@
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
},
"micromatch": {
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.9.tgz",
"integrity": "sha512-SlIz6sv5UPaAVVFRKodKjCg48EbNoIhgetzfK/Cy0v5U52Z6zB136M8tp0UC9jM53LYbmIRihJszvvqpKkfm9g==",
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
"requires": {
"arr-diff": "4.0.0",
"array-unique": "0.3.2",
"braces": "2.3.1",
"braces": "2.3.2",
"define-property": "2.0.2",
"extend-shallow": "3.0.2",
"extglob": "2.0.4",
@ -10956,7 +10967,7 @@
"object.pick": "1.3.0",
"regex-not": "1.0.0",
"snapdragon": "0.8.1",
"to-regex": "3.0.1"
"to-regex": "3.0.2"
}
},
"nanomatch": {
@ -10975,7 +10986,7 @@
"object.pick": "1.3.0",
"regex-not": "1.0.0",
"snapdragon": "0.8.1",
"to-regex": "3.0.1"
"to-regex": "3.0.2"
}
},
"schema-utils": {
@ -10983,9 +10994,31 @@
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==",
"requires": {
"ajv": "6.2.1",
"ajv": "6.4.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",
"timeago.js": "^3.0.2",
"tiny-queue": "^0.2.1",
"uglifyjs-webpack-plugin": "^1.2.4",
"web-animations-js": "^2.3.1",
"webpack": "^4.1.0",
"webpack": "^4.5.0",
"webpack-bundle-analyzer": "^2.11.1",
"workerize-loader": "^1.0.1",
"yargs": "^10.1.1"

View file

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