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

More cleanup (#1185)

* More cleanup

* Set up correct urls authorize.html

* Fix polymer lint

* Remove reference to bower

* Tweak uglify settings
This commit is contained in:
Paulus Schoutsen
2018-05-17 17:51:07 -04:00
committed by GitHub
parent cb0db95abe
commit bc27f854f1
25 changed files with 151 additions and 247 deletions

View File

@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const config = require('./config.js');
const version = fs.readFileSync('../setup.py', 'utf8').match(/\d{8}[^']*/);
@@ -12,8 +13,27 @@ const isProdBuild = process.env.NODE_ENV === 'production'
const chunkFilename = isProdBuild ?
'[name]-[chunkhash].chunk.js' : '[name].chunk.js';
const plugins = [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(!isProdBuild),
__VERSION__: JSON.stringify(VERSION),
})
];
if (isProdBuild) {
plugins.push(new UglifyJsPlugin({
extractComments: true,
sourceMap: true,
uglifyOptions: {
// Disabling because it broke output
mangle: false,
}
}));
}
module.exports = {
mode: isProdBuild ? 'production' : 'development',
devtool: isProdBuild ? 'source-map ' : 'inline-source-map',
entry: {
app: './src/hassio-app.js',
},
@@ -36,16 +56,11 @@ module.exports = {
}
]
},
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(!isProdBuild),
__VERSION__: JSON.stringify(VERSION),
})
],
plugins,
output: {
filename: '[name].js',
chunkFilename: chunkFilename,
path: config.buildDir,
publicPath: config.publicPath,
publicPath: `${config.publicPath}/`,
}
};