1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 12:49:19 +00:00

Further simplify build (#1256)

* Remove manual copy

* Use Webpack to create gzip versions
This commit is contained in:
Paulus Schoutsen
2018-06-04 07:06:12 -04:00
committed by GitHub
parent af14fc6548
commit 4d48a63141
6 changed files with 35 additions and 180 deletions

View File

@@ -4,6 +4,7 @@ const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WorkboxPlugin = require('workbox-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
const translationMetadata = require('./build-translations/translationMetadata.json');
const version = fs.readFileSync('setup.py', 'utf8').match(/\d{8}[^']*/);
@@ -61,6 +62,7 @@ function createConfig(isProdBuild, latestBuild) {
];
if (latestBuild) {
copyPluginOpts.push({ from: 'public', to: '.' });
copyPluginOpts.push({ from: 'build-translations/output', to: `translations` });
copyPluginOpts.push({ from: 'node_modules/@polymer/font-roboto-local/fonts', to: 'fonts' });
copyPluginOpts.push('node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js')
@@ -71,6 +73,7 @@ function createConfig(isProdBuild, latestBuild) {
entry['hass-icons'] = './src/entrypoints/hass-icons.js';
entry['service-worker-hass'] = './src/entrypoints/service-worker-hass.js';
} else {
copyPluginOpts.push('public/__init__.py');
babelOptions.presets = [
['es2015', { modules: false }]
];
@@ -86,6 +89,15 @@ function createConfig(isProdBuild, latestBuild) {
mangle: false,
}
}));
plugins.push(new CompressionPlugin({
cache: true,
exclude: [
/\.js\.map$/,
/\.LICENSE$/,
/\.py$/,
/\.txt$/,
]
}));
}
plugins.push(new WorkboxPlugin.InjectManifest({