mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-30 04:39:00 +01:00
[Refactoring] Update dependencies (#1365)
This commit is contained in:
parent
62bcbbd5cc
commit
94526b2362
6
.babelrc
6
.babelrc
@ -11,8 +11,8 @@
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
[
|
"@babel/plugin-proposal-class-properties",
|
||||||
"@babel/plugin-proposal-class-properties"
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
]
|
"@babel/plugin-syntax-nullish-coalescing-operator"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
setupFilesAfterEnv: ['./tests/init.js'],
|
setupFilesAfterEnv: ['./tests/init.js'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(css|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
'\\.(css|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|tgs)$':
|
||||||
'<rootDir>/tests/staticFileMock.js',
|
'<rootDir>/tests/staticFileMock.js',
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
@ -9,4 +9,5 @@ module.exports = {
|
|||||||
'<rootDir>/legacy_notes_and_workbook/',
|
'<rootDir>/legacy_notes_and_workbook/',
|
||||||
'<rootDir>/client/src/stylesheets/',
|
'<rootDir>/client/src/stylesheets/',
|
||||||
],
|
],
|
||||||
|
testEnvironment: 'jsdom',
|
||||||
};
|
};
|
||||||
|
16066
package-lock.json
generated
16066
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
133
package.json
133
package.json
@ -10,12 +10,12 @@
|
|||||||
"build:production": "npm i && rm -rf dist/ && APP_VERSION=$(npm run inc_version --silent) APP_ENV=production npm run build && ./deploy/copy_to_dist.sh",
|
"build:production": "npm i && rm -rf dist/ && APP_VERSION=$(npm run inc_version --silent) APP_ENV=production npm run build && ./deploy/copy_to_dist.sh",
|
||||||
"deploy:production": "npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push",
|
"deploy:production": "npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push",
|
||||||
"inc_version": "echo $((`cat .patch-version` + 1)) > .patch-version && echo \"$(node -p -e \"require('./package.json').version.match(/^\\d+\\.\\d+/)[0]\").$(cat .patch-version)\"",
|
"inc_version": "echo $((`cat .patch-version` + 1)) > .patch-version && echo \"$(node -p -e \"require('./package.json').version.match(/^\\d+\\.\\d+/)[0]\").$(cat .patch-version)\"",
|
||||||
"perf:serve": "APP_ENV=perf parcel src/index-perf.html",
|
"perf:serve": "cross-env APP_ENV=perf parcel src/index-perf.html",
|
||||||
"lint": "eslint . --ext .ts,.tsx --ignore-pattern src/lib/gramjs",
|
"lint": "eslint . --ext .ts,.tsx --ignore-pattern src/lib/gramjs",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"gramjs:tl": "node ./src/lib/gramjs/tl/generateModules.js",
|
"gramjs:tl": "node ./src/lib/gramjs/tl/generateModules.js",
|
||||||
"gramjs:lint:fix": "eslint ./src/lib/gramjs --ignore-path=src/lib/gramjs/.eslintignore --fix",
|
"gramjs:lint:fix": "eslint ./src/lib/gramjs --ignore-path=src/lib/gramjs/.eslintignore --fix",
|
||||||
"test": "APP_ENV=test jest --verbose --forceExit"
|
"test": "cross-env APP_ENV=test jest --verbose --forceExit"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.13",
|
"node": "^12.13",
|
||||||
@ -32,83 +32,86 @@
|
|||||||
"author": "Alexander Zinchuk (alexander@zinchuk.com)",
|
"author": "Alexander Zinchuk (alexander@zinchuk.com)",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.2",
|
"@babel/core": "^7.15.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.7.0",
|
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||||
"@babel/preset-env": "^7.10.2",
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
|
||||||
"@babel/preset-react": "^7.10.1",
|
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
|
||||||
"@babel/preset-typescript": "^7.10.1",
|
"@babel/preset-env": "^7.15.0",
|
||||||
"@peculiar/webcrypto": "^1.1.4",
|
"@babel/preset-react": "^7.14.5",
|
||||||
"@testing-library/jest-dom": "^5.11.6",
|
"@babel/preset-typescript": "^7.15.0",
|
||||||
"@types/croppie": "^2.5.4",
|
"@peculiar/webcrypto": "^1.1.7",
|
||||||
"@types/css-font-loading-module": "0.0.2",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
"@types/dom-mediacapture-record": "^1.0.3",
|
"@types/croppie": "^2.6.1",
|
||||||
"@types/jest": "^26.0.15",
|
"@types/css-font-loading-module": "0.0.6",
|
||||||
"@types/react": "^16.9.35",
|
"@types/dom-mediacapture-record": "^1.0.10",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/jest": "^27.0.0",
|
||||||
"@types/resize-observer-browser": "^0.1.3",
|
"@types/react": "^17.0.17",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.6.1",
|
"@types/react-dom": "^17.0.9",
|
||||||
"@typescript-eslint/parser": "^2.6.1",
|
"@types/resize-observer-browser": "^0.1.6",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
||||||
|
"@typescript-eslint/parser": "^4.29.1",
|
||||||
"@webpack-cli/serve": "^1.5.1",
|
"@webpack-cli/serve": "^1.5.1",
|
||||||
"autoprefixer": "^9.8.0",
|
"autoprefixer": "^10.3.1",
|
||||||
"babel-eslint": "^10.0.3",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.2.2",
|
||||||
"browserlist": "^1.0.1",
|
"browserlist": "^1.0.1",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "^3.5.3",
|
"css-loader": "^6.2.0",
|
||||||
"dotenv": "^8.2.0",
|
"css-minimizer-webpack-plugin": "^3.0.2",
|
||||||
"eslint": "^7.2.0",
|
"dotenv": "^10.0.0",
|
||||||
"eslint-config-airbnb-typescript": "^6.0.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-react-app": "^5.0.2",
|
"eslint-config-airbnb-typescript": "^12.3.1",
|
||||||
"eslint-import-resolver-webpack": "^0.12.1",
|
"eslint-config-react-app": "^6.0.0",
|
||||||
"eslint-plugin-flowtype": "^3.13.0",
|
"eslint-import-resolver-webpack": "^0.13.1",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-flowtype": "^5.9.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
"eslint-plugin-import": "^2.24.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||||
"eslint-plugin-no-async-without-await": "^1.2.0",
|
"eslint-plugin-no-async-without-await": "^1.2.0",
|
||||||
"eslint-plugin-no-null": "^1.0.2",
|
"eslint-plugin-no-null": "^1.0.2",
|
||||||
"eslint-plugin-react": "^7.16.0",
|
"eslint-plugin-react": "^7.24.0",
|
||||||
"eslint-plugin-react-hooks": "^1.7.0",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
"eslint-plugin-teactn": "github:korenskoy/eslint-plugin-teactn#8fbd2b9",
|
"eslint-plugin-teactn": "github:korenskoy/eslint-plugin-teactn#8fbd2b9",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-webpack-plugin": "^4.3.0",
|
"html-webpack-plugin": "^5.3.2",
|
||||||
"husky": "^3.0.9",
|
"husky": "^7.0.1",
|
||||||
"jest": "^26.6.3",
|
"jest": "^27.0.6",
|
||||||
"lint-staged": "^9.4.2",
|
"lint-staged": "^11.1.2",
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
"mini-css-extract-plugin": "^2.2.0",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^6.0.1",
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^6.1.1",
|
||||||
"postcss-modules": "^1.5.0",
|
"postcss-modules": "^4.2.2",
|
||||||
"raw-loader": "^4.0.1",
|
"raw-loader": "^4.0.2",
|
||||||
"react": "^16.12.0",
|
"react": "^17.0.2",
|
||||||
"replace-in-file": "^6.2.0",
|
"replace-in-file": "^6.2.0",
|
||||||
"sass": "^1.23.3",
|
"sass": "^1.37.5",
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^12.1.0",
|
||||||
"service-worker-loader": "^4.0.2",
|
"style-loader": "^3.2.1",
|
||||||
"style-loader": "^1.2.1",
|
"terser": "^5.7.1",
|
||||||
"terser": "^4.7.0",
|
"terser-webpack-plugin": "^5.1.4",
|
||||||
"terser-webpack-plugin": "^3.0.3",
|
"ts-node": "^10.2.0",
|
||||||
"ts-node": "^8.9.1",
|
"typescript": "^4.3.5",
|
||||||
"typescript": "^3.9.5",
|
"url-loader": "^4.1.1",
|
||||||
"url-loader": "^4.1.0",
|
"webpack": "^5.50.0",
|
||||||
"webpack": "^4.43.0",
|
"webpack-bundle-analyzer": "^4.4.2",
|
||||||
"webpack-bundle-analyzer": "^3.8.0",
|
|
||||||
"webpack-cli": "^4.7.2",
|
"webpack-cli": "^4.7.2",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
"webpack-merge": "^4.2.2",
|
"webpack-merge": "^5.8.0"
|
||||||
"worker-loader": "^2.0.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cryptography/aes": "^0.1.1",
|
"@cryptography/aes": "^0.1.1",
|
||||||
"async-mutex": "^0.1.4",
|
"async-mutex": "^0.3.1",
|
||||||
"big-integer": "painor/BigInteger.js",
|
"big-integer": "github:painor/BigInteger.js",
|
||||||
"croppie": "^2.6.4",
|
"croppie": "^2.6.5",
|
||||||
"emoji-data-ios": "github:korenskoy/emoji-data-ios#1a4532f",
|
"emoji-data-ios": "github:korenskoy/emoji-data-ios#1a4532f",
|
||||||
"events": "^3.0.0",
|
"events": "^3.3.0",
|
||||||
"idb-keyval": "^5.0.5",
|
"idb-keyval": "^5.1.3",
|
||||||
"opus-recorder": "github:Ajaxy/opus-recorder",
|
"opus-recorder": "github:Ajaxy/opus-recorder",
|
||||||
"pako": "^1.0.10",
|
"os-browserify": "^0.3.0",
|
||||||
|
"pako": "^2.0.4",
|
||||||
|
"path-browserify": "^1.0.1",
|
||||||
"qr-creator": "^1.0.0",
|
"qr-creator": "^1.0.0",
|
||||||
"websocket": "^1.0.30"
|
"websocket": "^1.0.34"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
src/@types/global.d.ts
vendored
19
src/@types/global.d.ts
vendored
@ -56,25 +56,6 @@ declare module 'pako/dist/pako_inflate' {
|
|||||||
|
|
||||||
type WindowWithPerf = typeof window & { perf: AnyLiteral };
|
type WindowWithPerf = typeof window & { perf: AnyLiteral };
|
||||||
|
|
||||||
declare module 'worker-loader!*' {
|
|
||||||
class WebpackWorker extends Worker {
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
|
|
||||||
export default WebpackWorker;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'service-worker-loader!*' {
|
|
||||||
const register: import('service-worker-loader/types').ServiceWorkerRegister;
|
|
||||||
const ServiceWorkerNoSupportError: import('service-worker-loader/types').ServiceWorkerNoSupportError;
|
|
||||||
const scriptUrl: import('service-worker-loader/types').ScriptUrl;
|
|
||||||
export default register;
|
|
||||||
export {
|
|
||||||
ServiceWorkerNoSupportError,
|
|
||||||
scriptUrl,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IWebpWorker extends Worker {
|
interface IWebpWorker extends Worker {
|
||||||
wasmReady?: boolean;
|
wasmReady?: boolean;
|
||||||
requests: Map<string, (value?: PromiseLike<TEncodedImage>) => void>;
|
requests: Map<string, (value?: PromiseLike<TEncodedImage>) => void>;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import Worker from 'worker-loader!./worker';
|
|
||||||
|
|
||||||
import { ApiInitialArgs, ApiOnProgress, OnApiUpdate } from '../../types';
|
import { ApiInitialArgs, ApiOnProgress, OnApiUpdate } from '../../types';
|
||||||
import { Methods, MethodArgs, MethodResponse } from '../methods/types';
|
import { Methods, MethodArgs, MethodResponse } from '../methods/types';
|
||||||
import { WorkerMessageEvent, ThenArg, OriginRequest } from './types';
|
import { WorkerMessageEvent, ThenArg, OriginRequest } from './types';
|
||||||
@ -27,7 +25,7 @@ export function initApi(onUpdate: OnApiUpdate, initialArgs: ApiInitialArgs) {
|
|||||||
console.log('>>> START LOAD WORKER');
|
console.log('>>> START LOAD WORKER');
|
||||||
}
|
}
|
||||||
|
|
||||||
worker = new Worker();
|
worker = new Worker(new URL('./worker.ts', import.meta.url));
|
||||||
subscribeToWorker(onUpdate);
|
subscribeToWorker(onUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
&-inner {
|
.shown-inner {
|
||||||
transform: scaleX(var(--toolbar-hidden-scale, 1));
|
transform: scaleX(var(--toolbar-hidden-scale, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import Worker from 'worker-loader!./rlottie.worker';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DPR,
|
DPR,
|
||||||
IS_SINGLE_COLUMN_LAYOUT,
|
IS_SINGLE_COLUMN_LAYOUT,
|
||||||
@ -29,7 +27,7 @@ const LOW_PRIORITY_MAX_FPS = 30;
|
|||||||
const HIGH_PRIORITY_CACHE_MODULO = IS_SAFARI ? 2 : 4;
|
const HIGH_PRIORITY_CACHE_MODULO = IS_SAFARI ? 2 : 4;
|
||||||
const LOW_PRIORITY_CACHE_MODULO = 0;
|
const LOW_PRIORITY_CACHE_MODULO = 0;
|
||||||
|
|
||||||
const workers = new Array(MAX_WORKERS).fill(undefined).map(() => new WorkerConnector(new Worker()));
|
const workers = new Array(MAX_WORKERS).fill(undefined).map(() => new WorkerConnector(new Worker(new URL('./rlottie.worker.ts', import.meta.url))));
|
||||||
let lastWorkerIndex = -1;
|
let lastWorkerIndex = -1;
|
||||||
|
|
||||||
class RLottie {
|
class RLottie {
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
import DecoderWorker from 'worker-loader!opus-recorder/dist/decoderWorker.min';
|
|
||||||
import WavWorker from 'worker-loader!opus-recorder/dist/waveWorker.min';
|
|
||||||
|
|
||||||
const SAMPLE_RATE = 48000;
|
const SAMPLE_RATE = 48000;
|
||||||
const BIT_DEPTH = 16;
|
const BIT_DEPTH = 16;
|
||||||
|
|
||||||
@ -10,8 +7,8 @@ export async function oggToWav(opusData: Blob): Promise<Blob> {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const typedArray = new Uint8Array(arrayBuffer);
|
const typedArray = new Uint8Array(arrayBuffer);
|
||||||
|
|
||||||
let decoderWorker: DecoderWorker | undefined = new DecoderWorker();
|
let decoderWorker: Worker | undefined = new Worker(new URL('opus-recorder/dist/decoderWorker.min.js', import.meta.url));
|
||||||
let wavWorker: WavWorker | undefined = new WavWorker();
|
let wavWorker: Worker | undefined = new Worker(new URL('opus-recorder/dist/waveWorker.min.js', import.meta.url));
|
||||||
|
|
||||||
decoderWorker.onmessage = (e) => {
|
decoderWorker.onmessage = (e) => {
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { scriptUrl } from 'service-worker-loader!../serviceWorker';
|
|
||||||
|
|
||||||
import { DEBUG } from '../config';
|
import { DEBUG } from '../config';
|
||||||
import { getDispatch } from '../lib/teact/teactn';
|
import { getDispatch } from '../lib/teact/teactn';
|
||||||
import { IS_ANDROID, IS_IOS, IS_SERVICE_WORKER_SUPPORTED } from './environment';
|
import { IS_ANDROID, IS_IOS, IS_SERVICE_WORKER_SUPPORTED } from './environment';
|
||||||
@ -36,7 +34,7 @@ function subscribeToWorker() {
|
|||||||
if (IS_SERVICE_WORKER_SUPPORTED) {
|
if (IS_SERVICE_WORKER_SUPPORTED) {
|
||||||
window.addEventListener('load', async () => {
|
window.addEventListener('load', async () => {
|
||||||
try {
|
try {
|
||||||
await navigator.serviceWorker.register(scriptUrl);
|
await navigator.serviceWorker.register(new URL('../serviceWorker.ts', import.meta.url));
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import WebpWorker from 'worker-loader!../lib/webp/webp_wasm.worker';
|
|
||||||
import { isWebpSupported } from './environment';
|
import { isWebpSupported } from './environment';
|
||||||
import { dataUriToBlob, blobToDataUri } from './files';
|
import { dataUriToBlob, blobToDataUri } from './files';
|
||||||
import { pause } from './schedulers';
|
import { pause } from './schedulers';
|
||||||
@ -50,7 +49,7 @@ export async function webpToPngBase64(key: string, url: string): Promise<string>
|
|||||||
|
|
||||||
function initWebpWorker() {
|
function initWebpWorker() {
|
||||||
if (!worker) {
|
if (!worker) {
|
||||||
worker = new WebpWorker() as IWebpWorker;
|
worker = new Worker(new URL('../lib/webp/webp_wasm.worker.js', import.meta.url)) as IWebpWorker;
|
||||||
worker.wasmReady = false;
|
worker.wasmReady = false;
|
||||||
worker.onmessage = handleLibWebpMessage;
|
worker.onmessage = handleLibWebpMessage;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
|
|
||||||
const { EnvironmentPlugin } = require('webpack');
|
const { EnvironmentPlugin, ProvidePlugin } = require('webpack');
|
||||||
const HtmlPlugin = require('html-webpack-plugin');
|
const HtmlPlugin = require('html-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||||
const TerserJSPlugin = require('terser-webpack-plugin');
|
const TerserJSPlugin = require('terser-webpack-plugin');
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
@ -14,6 +14,7 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
return {
|
return {
|
||||||
mode: argv.mode,
|
mode: argv.mode,
|
||||||
entry: './src/index.tsx',
|
entry: './src/index.tsx',
|
||||||
|
target: 'web',
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: [
|
contentBase: [
|
||||||
path.resolve(__dirname, 'public'),
|
path.resolve(__dirname, 'public'),
|
||||||
@ -30,6 +31,7 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
output: {
|
output: {
|
||||||
filename: '[name].[contenthash].js',
|
filename: '[name].[contenthash].js',
|
||||||
chunkFilename: '[id].[chunkhash].js',
|
chunkFilename: '[id].[chunkhash].js',
|
||||||
|
assetModuleFilename: '[name].[contenthash].[ext]',
|
||||||
path: path.resolve(__dirname, argv['output-path'] || 'dist'),
|
path: path.resolve(__dirname, argv['output-path'] || 'dist'),
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -63,10 +65,7 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff(2)?|ttf|eot|svg|png|jpg|tgs)(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.(woff(2)?|ttf|eot|svg|png|jpg|tgs)(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'file-loader',
|
type: 'asset/resource',
|
||||||
options: {
|
|
||||||
name: '[name].[contenthash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /-extra\.json$/,
|
test: /-extra\.json$/,
|
||||||
@ -92,6 +91,12 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.ts', '.tsx'],
|
extensions: ['.js', '.ts', '.tsx'],
|
||||||
|
fallback: {
|
||||||
|
path: require.resolve("path-browserify"),
|
||||||
|
os: require.resolve("os-browserify/browser"),
|
||||||
|
buffer: require.resolve("buffer/"),
|
||||||
|
fs: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new HtmlPlugin({
|
new HtmlPlugin({
|
||||||
@ -110,6 +115,9 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
TELEGRAM_T_API_HASH: '',
|
TELEGRAM_T_API_HASH: '',
|
||||||
TEST_SESSION: '',
|
TEST_SESSION: '',
|
||||||
}),
|
}),
|
||||||
|
new ProvidePlugin({
|
||||||
|
Buffer: ['buffer', 'Buffer'],
|
||||||
|
}),
|
||||||
...(argv.mode === 'production' ? [
|
...(argv.mode === 'production' ? [
|
||||||
new BundleAnalyzerPlugin({
|
new BundleAnalyzerPlugin({
|
||||||
analyzerMode: 'static',
|
analyzerMode: 'static',
|
||||||
@ -117,9 +125,6 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
}),
|
}),
|
||||||
] : []),
|
] : []),
|
||||||
],
|
],
|
||||||
node: {
|
|
||||||
fs: 'empty',
|
|
||||||
},
|
|
||||||
|
|
||||||
...(!env.noSourceMap && {
|
...(!env.noSourceMap && {
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
@ -130,7 +135,7 @@ module.exports = (env = {}, argv = {}) => {
|
|||||||
minimize: !env.noMinify,
|
minimize: !env.noMinify,
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserJSPlugin({ sourceMap: true }),
|
new TerserJSPlugin({ sourceMap: true }),
|
||||||
new OptimizeCSSAssetsPlugin({}),
|
new CssMinimizerPlugin(),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user