Files
Yogstation/tgui/webpack.config.js
Jamie D ee2a144ed2 [TG UPDATE] 5 - POOPER (#17312)
* Popper Tooltips 2 (they don't crash this time) (#58980)

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>

* Make tooltips use one popper, fixing mount lag (#61783)

In the last episode, I fixed update lag. This is what made the R&D console laggy to scroll through.

In this episode, we fix mount lag, which is what makes the R&D console laggy to open and search through, since it has to constantly make the new tooltips.

This is done by using a trick tippy.js uses, where they create one popper instance for multiple tooltips, then just move it around. I decided to emulate this by moving the popper stuff to Tooltip itself. The Popper component still exists as some non-tooltip consumers for it exist, such as preferences menu clothing selection. This is done through the ugliest code of my fucking life, but in a way that's totally transparent to consumers.

* Revert "Make tooltips use one popper, fixing mount lag (#61783)"

This reverts commit 180770b519.

* Another fix for laggy tgui tooltips -- Turn off popper event listeners (+ give R&D console its tooltips again) (#61343)

Every single popper registered TWO event listeners for scrolling and resizing. This does not appear to be necessary for our cases.
The R&D console has been given back its tooltips

* Make tooltips use one popper, fixing mount lag (#61783)

In the last episode, I fixed update lag. This is what made the R&D console laggy to scroll through.

In this episode, we fix mount lag, which is what makes the R&D console laggy to open and search through, since it has to constantly make the new tooltips.

This is done by using a trick tippy.js uses, where they create one popper instance for multiple tooltips, then just move it around. I decided to emulate this by moving the popper stuff to Tooltip itself. The Popper component still exists as some non-tooltip consumers for it exist, such as preferences menu clothing selection. This is done through the ugliest code of my fucking life, but in a way that's totally transparent to consumers.

* Make tooltips use one popper, fixing mount lag (#61783)

In the last episode, I fixed update lag. This is what made the R&D console laggy to scroll through.

In this episode, we fix mount lag, which is what makes the R&D console laggy to open and search through, since it has to constantly make the new tooltips.

This is done by using a trick tippy.js uses, where they create one popper instance for multiple tooltips, then just move it around. I decided to emulate this by moving the popper stuff to Tooltip itself. The Popper component still exists as some non-tooltip consumers for it exist, such as preferences menu clothing selection. This is done through the ugliest code of my fucking life, but in a way that's totally transparent to consumers.

* Revert "Make tooltips use one popper, fixing mount lag (#61783)"

This reverts commit 7eb9067222.

* Revert "Make tooltips use one popper, fixing mount lag (#61783)"

This reverts commit 346128869e.

* Revert "Another fix for laggy tgui tooltips -- Turn off popper event listeners (+ give R&D console its tooltips again) (#61343)"

This reverts commit bd3f395d76.

* tgui: Round Gauge (#55230)

This PR introduces the wacky round gauge for showing all of your favourite metrics in half-circle format. Show off those wacky numbers, use some scary blinking lights, feel alive!

I've also gone ahead and included this in the canister and tank (think internals) UIs. I've also done some refactoring of data sending from canisters because GOSH DANG it required some.

* GAWD DAMN IT

* EE

* Fixes Production issue

* Components

* e

* e

* Revert "e"

This reverts commit e9e804ba77.

* TOO SOON

* oops

* e

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Co-authored-by: Bobbahbrown <bobbahbrown@gmail.com>
2023-01-04 18:58:19 +00:00

171 lines
3.9 KiB
JavaScript

/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
const webpack = require('webpack');
const path = require('path');
const ExtractCssPlugin = require('mini-css-extract-plugin');
const { createBabelConfig } = require('./babel.config.js');
const createStats = verbose => ({
assets: verbose,
builtAt: verbose,
cached: false,
children: false,
chunks: false,
colors: true,
entrypoints: true,
hash: false,
modules: false,
performance: false,
timings: verbose,
version: verbose,
});
module.exports = (env = {}, argv) => {
const mode = argv.mode || 'production';
const config = {
mode: mode === 'production' ? 'production' : 'development',
context: path.resolve(__dirname),
target: ['web', 'es3', 'browserslist:ie 8'],
entry: {
'tgui': [
'./packages/tgui-polyfill',
'./packages/tgui',
],
'tgui-panel': [
'./packages/tgui-polyfill',
'./packages/tgui-panel',
],
},
output: {
path: argv.useTmpFolder
? path.resolve(__dirname, './public/.tmp')
: path.resolve(__dirname, './public'),
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
chunkLoadTimeout: 15000,
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {},
},
module: {
rules: [
{
test: /\.(js|cjs|ts|tsx)$/,
use: [
{
loader: require.resolve('babel-loader'),
options: createBabelConfig({ mode }),
},
],
},
{
test: /\.scss$/,
use: [
{
loader: ExtractCssPlugin.loader,
options: {
esModule: false,
},
},
{
loader: require.resolve('css-loader'),
options: {
esModule: false,
},
},
{
loader: require.resolve('sass-loader'),
},
],
},
{
test: /\.(png|jpg|svg)$/,
use: [
{
loader: require.resolve('url-loader'),
options: {
esModule: false,
},
},
],
},
],
},
optimization: {
emitOnErrors: false,
},
performance: {
hints: false,
},
devtool: false,
cache: {
type: 'filesystem',
cacheLocation: path.resolve(__dirname, `.yarn/webpack/${mode}`),
buildDependencies: {
config: [__filename],
},
},
stats: createStats(true),
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: env.NODE_ENV || mode,
WEBPACK_HMR_ENABLED: env.WEBPACK_HMR_ENABLED || argv.hot || false,
DEV_SERVER_IP: env.DEV_SERVER_IP || null,
}),
new ExtractCssPlugin({
filename: '[name].bundle.css',
chunkFilename: '[name].bundle.css',
}),
],
};
// Add a bundle analyzer to the plugins array
if (argv.analyze) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
config.plugins = [
...config.plugins,
new BundleAnalyzerPlugin(),
];
}
// Production build specific options
if (mode === 'production') {
const TerserPlugin = require('terser-webpack-plugin');
config.optimization.minimizer = [
new TerserPlugin({
extractComments: false,
terserOptions: {
ie8: true,
output: {
ascii_only: true,
comments: false,
},
},
}),
];
}
// Development build specific options
if (mode !== 'production') {
config.devtool = 'cheap-module-source-map';
}
// Development server specific options
if (argv.devServer) {
config.devServer = {
progress: false,
quiet: false,
noInfo: false,
clientLogLevel: 'silent',
stats: createStats(false),
};
}
return config;
};