Verified Commit 0733870f authored by Morgan Bazalgette's avatar Morgan Bazalgette Committed by Haelwenn

remove bundle analyzer, remove chunk hashes from css, create build.sh

parent 96961f02
#!/bin/sh
TARGET="${TARGET:-../pleroma}" # Where pleroma’s repository is sitting
static_dir="priv/static" # Set this to instance/static when testing production build
if [[ ! -d "${TARGET}/${static_dir}" ]]
then
echo "Error: ${TARGET}/${static_dir} directory is missing, are you sure TARGET is set to a pleroma repository?"
echo "Info: TARGET=${TARGET}"
exit 1
fi
yarn install -D
rm -rf public/packs public/assets
env -i "PATH=$PATH" npm run build
cp public/assets/sw.js "${TARGET}/${static_dir}/sw.js"
rm -rf "${TARGET}/${static_dir}/packs"
cp -r public/packs "${TARGET}/${static_dir}/packs"
rm -rf "${TARGET}/${static_dir}/emoji/*.svg"
cp -r public/emoji/* "${TARGET}/${static_dir}/emoji"
......@@ -23,6 +23,8 @@ module.exports = merge(sharedConfig, {
},
output: {
filename: '[name].js',
chunkFilename: '[name].js',
pathinfo: true,
},
......
......@@ -3,10 +3,8 @@
const path = require('path');
const { URL } = require('url');
const merge = require('webpack-merge');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const OfflinePlugin = require('offline-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const { output } = require('./configuration');
const sharedConfig = require('./shared');
......@@ -27,6 +25,10 @@ if (process.env.S3_ENABLED === 'true') {
module.exports = merge(sharedConfig, {
mode: 'production',
output: {
filename: '[name].js',
chunkFilename: '[name].js',
},
devtool: 'source-map',
stats: 'normal',
bail: true,
......@@ -52,16 +54,6 @@ module.exports = merge(sharedConfig, {
},
plugins: [
new CompressionPlugin({
filename: '[path].gz[query]',
cache: true,
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/,
}),
new BundleAnalyzerPlugin({ // generates report.html
analyzerMode: 'static',
openAnalyzer: false,
logLevel: 'silent', // do not bother Webpacker, who runs with --json and parses stdout
}),
new OfflinePlugin({
publicPath: output.publicPath, // sw.js must be served from the root to avoid scope issues
caches: {
......@@ -85,7 +77,6 @@ module.exports = merge(sharedConfig, {
'/emoji/sheet_10.png', // used in emoji-mart
],
excludes: [
'**/*.gz',
'**/*.map',
'stats.json',
'report.html',
......
......@@ -100,8 +100,7 @@ module.exports = {
}
),
new MiniCssExtractPlugin({
filename: 'css/[name]-[contenthash:8].css',
chunkFilename: 'css/[name]-[contenthash:8].chunk.css',
filename: '[name].css',
}),
new AssetsManifestPlugin({
integrity: false,
......
This diff is collapsed.
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