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

Prettier 💎 (#1737)

* Add prettier

* Apply Prettier
This commit is contained in:
Paulus Schoutsen
2018-10-11 12:22:11 +02:00
committed by GitHub
parent 3b425c3e14
commit 34bfc12647
472 changed files with 12402 additions and 9875 deletions

View File

@@ -1,26 +1,25 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
const config = require('./config.js');
const config = require("./config.js");
const isProdBuild = process.env.NODE_ENV === 'production'
const chunkFilename = isProdBuild ?
'chunk.[chunkhash].js' : '[name].chunk.js';
const isProdBuild = process.env.NODE_ENV === "production";
const chunkFilename = isProdBuild ? "chunk.[chunkhash].js" : "[name].chunk.js";
module.exports = {
mode: isProdBuild ? 'production' : 'development',
devtool: isProdBuild ? 'source-map' : 'inline-source-map',
mode: isProdBuild ? "production" : "development",
devtool: isProdBuild ? "source-map" : "inline-source-map",
entry: {
entrypoint: './src/entrypoint.js',
entrypoint: "./src/entrypoint.js",
},
module: {
rules: [
{
test: /\.m?js$/,
use: {
loader: 'babel-loader',
loader: "babel-loader",
options: {
presets: [
[require('babel-preset-env').default, { modules: false }]
[require("babel-preset-env").default, { modules: false }],
],
plugins: [
// Only support the syntax, Webpack will handle it.
@@ -32,38 +31,34 @@ module.exports = {
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
loader: "html-loader",
options: {
exportAsEs6Default: true,
}
}
}
]
},
},
},
],
},
plugins: [
isProdBuild && new UglifyJsPlugin({
extractComments: true,
sourceMap: true,
uglifyOptions: {
// Disabling because it broke output
mangle: false,
}
}),
isProdBuild && new CompressionPlugin({
cache: true,
exclude: [
/\.js\.map$/,
/\.LICENSE$/,
/\.py$/,
/\.txt$/,
]
}),
isProdBuild &&
new UglifyJsPlugin({
extractComments: true,
sourceMap: true,
uglifyOptions: {
// Disabling because it broke output
mangle: false,
},
}),
isProdBuild &&
new CompressionPlugin({
cache: true,
exclude: [/\.js\.map$/, /\.LICENSE$/, /\.py$/, /\.txt$/],
}),
].filter(Boolean),
output: {
filename: '[name].js',
filename: "[name].js",
chunkFilename,
path: config.buildDir,
publicPath: `${config.publicPath}/`,
}
},
};