Restore old Hass.io HTML build (#1218)

This commit is contained in:
Paulus Schoutsen 2018-05-27 17:24:40 -04:00 committed by GitHub
parent 66012da4de
commit 045b1d02be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -19,7 +19,7 @@
function addScript(src) {
var e = document.createElement('script');
e.src = src;
document.head.appendChild(e);
document.write(e.outerHTML);
}
var webComponentsSupported = (
'customElements' in window &&
@ -29,6 +29,10 @@
addScript('/static/webcomponents-bundle.js');
}
</script>
<script src="./app.js"></script>
<!--
Disabled while we make Home Assistant able to serve the right files.
<script src="./app.js"></script>
-->
<link rel='import' href='./hassio-app.html'>
</body>
</html>

View File

@ -12,3 +12,11 @@ rm -rf $OUTPUT_DIR_ES5
node script/gen-icons.js
NODE_ENV=production ../node_modules/.bin/webpack -p
node script/gen-index-html.js
# Temporarily re-create old HTML import
echo "<script>" > $OUTPUT_DIR_ES5/hassio-app.html
cat $OUTPUT_DIR_ES5/app.js >> $OUTPUT_DIR_ES5/hassio-app.html
cat $OUTPUT_DIR_ES5/chunk.*.js >> $OUTPUT_DIR_ES5/hassio-app.html
echo "</script>" >> $OUTPUT_DIR_ES5/hassio-app.html
rm $OUTPUT_DIR_ES5/app.js*
rm $OUTPUT_DIR_ES5/chunk.*

View File

@ -11,7 +11,7 @@ if (!version) {
const VERSION = version[0];
const isProdBuild = process.env.NODE_ENV === 'production'
const chunkFilename = isProdBuild ?
'[name]-[chunkhash].chunk.js' : '[name].chunk.js';
'chunk.[chunkhash].js' : '[name].chunk.js';
const plugins = [
new webpack.DefinePlugin({
@ -33,7 +33,9 @@ if (isProdBuild) {
module.exports = {
mode: isProdBuild ? 'production' : 'development',
devtool: isProdBuild ? 'source-map ' : 'inline-source-map',
// Disabled in prod while we make Home Assistant able to serve the right files.
// Was source-map
devtool: isProdBuild ? 'none' : 'inline-source-map',
entry: {
app: './src/hassio-app.js',
},