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

Add gallery (#1475)

* Add gallery

* Add build script

* Lint

* Remove cache
This commit is contained in:
Paulus Schoutsen
2018-07-19 15:24:30 +02:00
committed by GitHub
parent 5cc6d20674
commit 56907fb922
12 changed files with 1967 additions and 15 deletions

69
gallery/webpack.config.js Normal file
View File

@@ -0,0 +1,69 @@
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProd = process.env.NODE_ENV === 'production';
const chunkFilename = isProd ?
'chunk.[chunkhash].js' : '[name].chunk.js';
const buildPath = path.resolve(__dirname, 'dist');
const publicPath = isProd ? './' : 'http://localhost:8080/';
module.exports = {
mode: isProd ? 'production' : 'development',
// Disabled in prod while we make Home Assistant able to serve the right files.
// Was source-map
devtool: isProd ? 'none' : 'inline-source-map',
entry: './src/entrypoint.js',
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
// Only support the syntax, Webpack will handle it.
'syntax-dynamic-import',
[
'transform-react-jsx',
{
pragma: 'h'
}
],
],
},
},
},
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
options: {
exportAsEs6Default: true,
}
}
},
]
},
plugins: [
new CopyWebpackPlugin(['public']),
isProd && new UglifyJsPlugin({
extractComments: true,
sourceMap: true,
uglifyOptions: {
// Disabling because it broke output
mangle: false,
}
}),
].filter(Boolean),
output: {
filename: '[name].js',
chunkFilename: chunkFilename,
path: buildPath,
publicPath,
},
devServer: {
contentBase: './public',
}
};