Unverified Commit cd02fb07 authored by Morgan Bazalgette's avatar Morgan Bazalgette Committed by Haelwenn

remove gzip on assets, add build.sh

pickups:
- build.sh: Make the target dir configurable
- build.sh: Auto-update yarn dependencies
Co-authored-by: Haelwenn's avatarHaelwenn (lanodan) Monnier <contact@hacktivis.me>
parent 231377a5
#!/bin/sh
TARGET="../pleroma" # Where pleroma’s repository is sitting
yarn install -D
rm -rf public/packs public/assets
env -i "PATH=$PATH" npm run build
cp public/assets/sw.js "${TARGET}/priv/static/sw.js"
rm -rf "${TARGET}/priv/static/packs"
cp -r public/packs "${TARGET}/priv/static/packs"
// Note: You must restart bin/webpack-dev-server for changes to take effect
const merge = require('webpack-merge');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const sharedConfig = require('./shared.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const OfflinePlugin = require('offline-plugin');
......@@ -10,16 +8,6 @@ const { publicPath } = require('./configuration.js');
const path = require('path');
const { URL } = require('url');
let compressionAlgorithm;
try {
const zopfli = require('node-zopfli');
compressionAlgorithm = (content, options, fn) => {
zopfli.gzip(content, options, fn);
};
} catch (error) {
compressionAlgorithm = 'gzip';
}
let attachmentHost;
if (process.env.S3_ENABLED === 'true') {
......@@ -39,8 +27,8 @@ module.exports = merge(sharedConfig, {
mode: 'production',
output: {
filename: '[name]-[chunkhash].js',
chunkFilename: '[name]-[chunkhash].js',
filename: '[name].js',
chunkFilename: '[name].js',
},
devtool: 'source-map', // separate sourcemap file, suitable for production
......@@ -68,11 +56,6 @@ module.exports = merge(sharedConfig, {
},
plugins: [
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: compressionAlgorithm,
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/,
}),
new OfflinePlugin({
publicPath: publicPath, // sw.js must be served from the root to avoid scope issues
caches: {
......@@ -96,7 +79,6 @@ module.exports = merge(sharedConfig, {
'/emoji/sheet_10.png', // used in emoji-mart
],
excludes: [
'**/*.gz',
'**/*.map',
'stats.json',
'report.html',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment