Revert "Use gulp-terser instead of webpack-terser (#5788)" (#5796)

pull/5798/head
Paulus Schoutsen 2020-05-07 09:28:51 -07:00 committed by GitHub
parent 5084cde6b9
commit b69d5e0fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 97 deletions

View File

@ -9,7 +9,6 @@ require("./gen-icons-json.js");
require("./gather-static.js");
require("./compress.js");
require("./webpack.js");
require("./minify.js");
require("./service-worker.js");
require("./entry-html.js");
@ -43,7 +42,7 @@ gulp.task(
"copy-static",
"webpack-prod-app",
...// Don't compress running tests
(envVars.isTest() ? [] : ["minify-app", "compress-app"]),
(envVars.isTest() ? [] : ["compress-app"]),
gulp.parallel(
"gen-pages-prod",
"gen-index-app-prod",

View File

@ -4,7 +4,6 @@ require("./clean.js");
require("./translations.js");
require("./gather-static.js");
require("./webpack.js");
require("./minify.js");
require("./service-worker.js");
require("./entry-html.js");
@ -33,7 +32,6 @@ gulp.task(
gulp.parallel("gen-icons-json", "build-translations"),
"copy-static-cast",
"webpack-prod-cast",
"minify-cast",
"gen-index-cast-prod"
)
);

View File

@ -6,7 +6,6 @@ require("./translations.js");
require("./gen-icons-json.js");
require("./gather-static.js");
require("./webpack.js");
require("./minify.js");
require("./service-worker.js");
require("./entry-html.js");
@ -36,7 +35,6 @@ gulp.task(
gulp.parallel("gen-icons-json", "build-translations"),
"copy-static-demo",
"webpack-prod-demo",
"minify-demo",
"gen-index-demo-prod"
)
);

View File

@ -6,7 +6,6 @@ require("./translations.js");
require("./gen-icons-json.js");
require("./gather-static.js");
require("./webpack.js");
require("./minify.js");
require("./service-worker.js");
require("./entry-html.js");
@ -36,7 +35,6 @@ gulp.task(
gulp.parallel("gen-icons-json", "build-translations"),
"copy-static-gallery",
"webpack-prod-gallery",
"minify-gallery",
"gen-index-gallery-prod"
)
);

View File

@ -1,47 +0,0 @@
const path = require("path");
const gulp = require("gulp");
const terser = require("gulp-terser");
const merge = require("merge-stream");
const paths = require("../paths");
function minifyStream(source, latestBuild) {
return gulp
.src(path.resolve(source, "**/*.js"))
.pipe(
terser({
output: { comments: false },
safari10: true,
ecma: latestBuild ? undefined : 5,
})
)
.pipe(gulp.dest(source));
}
gulp.task("minify-app", function minifyJS() {
return merge([
minifyStream(paths.output, true),
minifyStream(paths.output_es5, false),
]);
});
gulp.task("minify-demo", function minifyJS() {
return merge([
minifyStream(paths.demo_output, true),
minifyStream(paths.demo_output_es5, false),
]);
});
gulp.task("minify-cast", function minifyJS() {
return merge([
minifyStream(paths.cast_output, true),
minifyStream(paths.cast_output_es5, false),
]);
});
gulp.task("minify-hassio", function minifyJS() {
return minifyStream(paths.hassio_root, false);
});
gulp.task("minify-gallery", function minifyJS() {
minifyStream(paths.gallery_output, false);
});

View File

@ -29,7 +29,7 @@ const createWebpackConfig = ({
}
return {
mode: isProdBuild ? "production" : "development",
devtool: isProdBuild ? undefined : "inline-cheap-module-source-map",
devtool: isProdBuild ? "source-map" : "inline-cheap-module-source-map",
entry,
module: {
rules: [
@ -54,18 +54,17 @@ const createWebpackConfig = ({
},
optimization: {
minimizer: [
// We minify in gulp. Only minify if we look at stats.
isStatsBuild &&
new TerserPlugin({
cache: true,
parallel: true,
extractComments: true,
terserOptions: {
safari10: true,
ecma: latestBuild ? undefined : 5,
},
}),
].filter(Boolean),
new TerserPlugin({
cache: true,
parallel: true,
extractComments: true,
sourceMap: true,
terserOptions: {
safari10: true,
ecma: latestBuild ? undefined : 5,
},
}),
],
},
plugins: [
new ManifestPlugin(),

View File

@ -161,7 +161,6 @@
"gulp-jsonminify": "^1.1.0",
"gulp-merge-json": "^1.3.1",
"gulp-rename": "^2.0.0",
"gulp-terser": "^1.2.0",
"gulp-zopfli-green": "^3.0.1",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",

View File

@ -8037,16 +8037,6 @@ gulp-sourcemaps@1.6.0:
through2 "^2.0.0"
vinyl "^1.0.0"
gulp-terser@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/gulp-terser/-/gulp-terser-1.2.0.tgz#41df2a1d0257d011ba8b05efb2568432ecd0495b"
integrity sha512-lf+jE2DALg2w32p0HRiYMlFYRYelKZPNunHp2pZccCYrrdCLOs0ItbZcN63yr2pbz116IyhUG9mD/QbtRO1FKA==
dependencies:
plugin-error "^1.0.1"
terser "^4.0.0"
through2 "^3.0.1"
vinyl-sourcemaps-apply "^0.2.1"
gulp-util@~2.2.14:
version "2.2.20"
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-2.2.20.tgz#d7146e5728910bd8f047a6b0b1e549bc22dbd64c"
@ -13131,7 +13121,7 @@ source-map-url@^0.4.0:
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=
source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0:
source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
@ -13786,15 +13776,6 @@ terser@^3.16.1:
source-map "~0.6.1"
source-map-support "~0.5.10"
terser@^4.0.0:
version "4.6.13"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.13.tgz#e879a7364a5e0db52ba4891ecde007422c56a916"
integrity sha512-wMvqukYgVpQlymbnNbabVZbtM6PN63AzqexpwJL8tbh/mRT9LE5o+ruVduAGL7D6Fpjl+Q+06U5I9Ul82odAhw==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
source-map-support "~0.5.12"
terser@^4.1.2:
version "4.3.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65"
@ -13873,7 +13854,7 @@ through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@~2.0.0:
readable-stream "~2.3.6"
xtend "~4.0.1"
through2@^3.0.0, through2@^3.0.1:
through2@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a"
integrity sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==
@ -14601,13 +14582,6 @@ vinyl-sourcemap@^1.1.0:
remove-bom-buffer "^3.0.0"
vinyl "^2.0.0"
vinyl-sourcemaps-apply@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705"
integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=
dependencies:
source-map "^0.5.1"
vinyl@^0.2.1:
version "0.2.3"
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.2.3.tgz#bca938209582ec5a49ad538a00fa1f125e513252"