From 434029dae938410f72bc409920c7e06ce3c0f96f Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Wed, 15 Mar 2023 12:50:02 +0100 Subject: [PATCH] fix: babel jassub worker --- babel.config.js | 9 +-------- src/plugins/htmlVideoPlayer/plugin.js | 6 ++++-- webpack.common.js | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/babel.config.js b/babel.config.js index fcd9dcb4a..e31ea2312 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,14 +12,7 @@ module.exports = { corejs: 3 } ], - '@babel/preset-react', - [ - '@babel/preset-typescript', - { - isTSX: true, - allExtensions: true - } - ] + '@babel/preset-react' ], plugins: [ '@babel/plugin-proposal-class-properties', diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 2d99af9d9..ad1c58d48 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1213,8 +1213,10 @@ function tryRemoveElement(elem) { fonts: avaliableFonts, fallbackFont: 'liberation sans', availableFonts: {'liberation sans': `${appRouter.baseUrl()}/libraries/default.woff2`}, - workerUrl: `${appRouter.baseUrl()}/libraries/jassub-worker.js`, - legacyWorkerUrl: `${appRouter.baseUrl()}/libraries/jassub-worker-legacy.js`, + // eslint-disable-next-line compat/compat + workerUrl: `${appRouter.baseUrl()}/${new URL('jassub/dist/jassub-worker.js', import.meta.url)}`, + // eslint-disable-next-line compat/compat + legacyWorkerUrl: `${appRouter.baseUrl()}/${new URL('jassub/dist/jassub-worker-legacy.js', import.meta.url)}`, timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000, // new jassub options; override all, even defaults blendMode: 'js', diff --git a/webpack.common.js b/webpack.common.js index 93460fc5a..31bed4205 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -8,9 +8,7 @@ const { DefinePlugin } = require('webpack'); const Assets = [ 'native-promise-only/npo.js', 'libarchive.js/dist/worker-bundle.js', - 'jassub/dist/jassub-worker.js', 'jassub/dist/jassub-worker.wasm', - 'jassub/dist/jassub-worker-legacy.js', 'jassub/dist/jassub-worker-legacy.mem', 'jassub/dist/default.woff2', 'pdfjs-dist/build/pdf.worker.js' @@ -146,7 +144,6 @@ const config = { { test: /\.(js|jsx)$/, include: [ - path.resolve(__dirname, 'node_modules/jassub'), path.resolve(__dirname, 'node_modules/rvfc-polyfill'), path.resolve(__dirname, 'node_modules/@jellyfin/sdk'), path.resolve(__dirname, 'node_modules/@remix-run/router'), @@ -174,6 +171,20 @@ const config = { } }] }, + { + test: /\.js$/, + include: [ + path.resolve(__dirname, 'node_modules/jassub') + ], + use: [{ + loader: 'babel-loader', + options: { + cacheCompression: false, + cacheDirectory: true, + presets: ['@babel/preset-env'] + } + }] + }, { test: /\.worker\.ts$/, exclude: /node_modules/,