Files
fulpstation/tgui/webpack.config.js
A miscellaneous Fern 9bd86e85b5 June/July TGU: Loadout menu, flatpackers and... whatever else! (#1230)
* Initial Commit

* Not quite all was staged, apparently.

* Multiline no longer necessary

* For my convenience...

* Forgot an important little tidbit in routes.tsx

* This updated, apparently.

* And now hell breaks loose

* First batch

* Second Batch

* Third batch (Unit Tests)

* Improvised shotgun ammo is gone; Vibebots are refactored

* UpdatePath sweeps in our fulp_modules/_maps folder

* I can't bring myself to do it.

* Map stuff

* Didn't mean to leave this uncommented

* I carpet-bombed them with Find-Replace. Let's see what linters think

* I sure do hope this is comprehensive and doesn't break other things

* This may take a while

* Next Round

* Hopefully the last batch before getting on with actual fixes

* Telescreens

* :/

* Stragglers

* Helio Emergency Shuttle; NearStation adjustments.

* Only one more commit for greenchecks... Shuttle code be dammed.

* Pff, the file was missing

* Same treatment as the other map files.

* Missed a comma :P

* BZ chambers for Xenobiology

* Odd. Most of these got done earlier. Not sure why this one wasn't.

* Mapping sweep. I didn't adjust C_tags in Theia. Another time.

* The balloon alerts overlap

* I hate TGU I hate TGU

* I meant to say "I hate TG" on the last one. Freudian slip.

* Fix Fix

* Nanite research cost rebalance

* TGU-Update: Step 0

* Yeah I figured it'd do this.

* I accidentally undid this

* Failed to catch this one

* I don't trust hundredths not to break or be broken somewhere.

* Little air alarm tweaks

* Ports #1228

* Stuff I missed

* Silly

* TGU so nice we're going to make it thrice

* Yarn

* Should be all? Fixes cult stun too.

* Thermomachine layers

* Free square spellcheck to rerun tests and see if it's consistent

* All credit goes to QLA for reminding me to actually do this

* Update to e40becd742

* github folder
2024-08-06 20:17:51 -04:00

161 lines
3.7 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 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 bench = env.TGUI_BENCH;
const config = {
mode: mode === 'production' ? 'production' : 'development',
context: path.resolve(__dirname),
target: ['web', 'es5', 'browserslist:ie 11'],
entry: {
tgui: ['./packages/tgui-polyfill', './packages/tgui'],
'tgui-panel': ['./packages/tgui-polyfill', './packages/tgui-panel'],
'tgui-say': ['./packages/tgui-polyfill', './packages/tgui-say'],
},
output: {
path: argv.useTmpFolder
? path.resolve(__dirname, './public/.tmp')
: path.resolve(__dirname, './public'),
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
chunkLoadTimeout: 15000,
publicPath: '/',
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx'],
alias: {},
},
module: {
rules: [
{
test: /\.([tj]s(x)?|cjs)$/,
exclude: /node_modules[\\/]core-js/,
use: [
{
loader: require.resolve('swc-loader'),
},
],
},
{
test: /\.(s)?css$/,
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',
}),
],
};
if (bench) {
config.entry = {
'tgui-bench': [
'./packages/tgui-polyfill',
'./packages/tgui-bench/entrypoint',
],
};
}
// Production build specific options
if (mode === 'production') {
const { EsbuildPlugin } = require('esbuild-loader');
config.optimization.minimizer = [
new EsbuildPlugin({
target: 'ie11',
css: true,
}),
];
}
// 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;
};