1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00
FrankerFaceZ/webpack.web.prod.js
SirStendec 04aa1789a2 4.5.4
* Fixed: Raven's updated Vue plugin causing Vue to fail to load.
* Fixed: Placeholder text when editing chat ban reasons.
2019-06-20 15:30:18 -04:00

66 lines
No EOL
1.5 KiB
JavaScript

const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.web.common.js');
const CopyPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const Terser = require('terser');
// Get Git info
const commit_hash = require('child_process').execSync('git rev-parse HEAD').toString().trim();
/* global module Buffer */
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
optimization: {
concatenateModules: false,
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
keep_classnames: true,
keep_fnames: true
}
})
]
},
plugins: [
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
__git_commit__: JSON.stringify(commit_hash)
}),
new CopyPlugin([
{
from: './src/entry.js',
to: 'script.min.js',
transform: content => {
const text = content.toString('utf8');
const minified = Terser.minify(text);
return (minified && minified.code) ? Buffer.from(minified.code) : content;
}
}
]),
new ManifestPlugin({
publicPath: '',
map: data => {
if ( data.name.endsWith('.scss') )
data.name = `${data.name.substr(0,data.name.length - 5)}.css`;
return data;
}
})
],
output: {
publicPath: '//cdn.frankerfacez.com/static/',
filename: '[name].[hash].js'
}
});