Use hashes for hassio entrypoints (#6260)

This commit is contained in:
Paulus Schoutsen
2020-06-29 00:31:07 -07:00
committed by GitHub
parent fb7f620316
commit d33f18ecb7
4 changed files with 43 additions and 27 deletions

View File

@@ -11,24 +11,6 @@ require("./webpack.js");
require("./compress.js");
require("./rollup.js");
async function writeEntrypointJS() {
// We ship two builds and we need to do feature detection on what version to load.
fs.mkdirSync(paths.hassio_output_root, { recursive: true });
fs.writeFileSync(
path.resolve(paths.hassio_output_root, "entrypoint.js"),
`
try {
new Function("import('${paths.hassio_publicPath}/frontend_latest/entrypoint.js')")();
} catch (err) {
var el = document.createElement('script');
el.src = '${paths.hassio_publicPath}/frontend_es5/entrypoint.js';
document.body.appendChild(el);
}
`,
{ encoding: "utf-8" }
);
}
gulp.task(
"develop-hassio",
gulp.series(
@@ -37,7 +19,7 @@ gulp.task(
},
"clean-hassio",
"gen-icons-json",
writeEntrypointJS,
"gen-index-hassio-dev",
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
)
);
@@ -51,7 +33,7 @@ gulp.task(
"clean-hassio",
"gen-icons-json",
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
writeEntrypointJS,
"gen-index-hassio-prod",
...// Don't compress running tests
(env.isTest() ? [] : ["compress-hassio"])
)