1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-19 04:41:11 +00:00
transmission/web/webpack.config.js
Derek Reiff 6187cfd67b
Refresh web interface across desktop and mobile (#3985)
* Add macOS section to Web-Interface docs

- Add minimal steps to enable web interface on macOS
- Clean up README.md with some markdown linting.

* Updating and modernizing web interface, colors, icons

In general:

- increase spacing and decrease font sizes in most inspectors (so far)
- replace icons  with emoji. may not be the way to go in the end

* update toolbar icon sizes to adjust for differences

* Switch from icons to buttons, other minor color changes

1. Add 'warn' class to dangerous actions
2. Add 'table-row' helper to overflow menu
3. Use text instead of icons for this new tab style

* Update icons using feathericons.com

* Rename files, replace some SVG and optimize PNG

* Remove more unused variables

* Update index.html to reflect new icons

* More minor svg changes; delete old images

* Updated build output

* Remove icons, add new feather svg icons

Build is now sub-200 KB
2022-10-21 12:22:59 -05:00

77 lines
1.8 KiB
JavaScript

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');
const mode = process.env.WEBPACK_MODE || 'production';
const devPort = process.env.DEV_PORT || 9000;
const rpcUrl = process.env.RPC_URL || 'http://localhost:9091/transmission/rpc';
const config = {
devtool: 'source-map',
entry: './src/main.js',
mode,
module: {
rules: [
{
test: /\.s(a|c)ss$/,
use: [
'style-loader', // create 'style' nodes from JS strings
'css-loader', // translate css into commonjs
'sass-loader', // compile sass into css
],
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
include: /(assets)\/(img)/,
test: /\.(jpe?g|png|gif|svg|webp)$/,
type: 'asset/inline',
},
],
},
optimization: {
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
},
output: {
filename: 'transmission-app.js',
path: path.resolve(__dirname, 'public_html'),
sourceMapFilename: 'transmission-app.js.map'
},
plugins: [
new MiniCssExtractPlugin({
chunkFilename: '[id].css',
filename: '[name].css',
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
resolve: {
extensions: ['.js', '.scss']
},
};
if (mode === 'development') {
config.devServer = {
compress: true,
historyApiFallback: {
rewrites: [
{ from: '/transmission/web', to: '/' },
]
},
hot: true,
port: devPort,
proxy: {
'/rpc': rpcUrl
},
static: './public_html'
};
}
module.exports = config;