Fix libarchive bundling

This commit is contained in:
Bill Thornton 2024-09-11 10:07:18 -04:00
parent a014f2775e
commit bec74d2949
3 changed files with 7 additions and 15 deletions

View File

@ -5,7 +5,6 @@
"not": [
"./dist/libraries/pdf.worker.js",
"./dist/libraries/worker-bundle.js",
"./dist/libraries/wasm-gen/libarchive.js",
"./dist/serviceworker.js"
]
}

View File

@ -1,4 +1,3 @@
// eslint-disable-next-line import/named, import/namespace
import { Archive } from 'libarchive.js';
import loading from '../../components/loading/loading';
import dialogHelper from '../../components/dialogHelper/dialogHelper';

View File

@ -4,12 +4,13 @@ const CopyPlugin = require('copy-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { DefinePlugin } = require('webpack');
const { DefinePlugin, IgnorePlugin } = require('webpack');
const packageJson = require('./package.json');
const Assets = [
'native-promise-only/npo.js',
'libarchive.js/dist/worker-bundle.js',
'libarchive.js/dist/libarchive.wasm',
'@jellyfin/libass-wasm/dist/js/default.woff2',
'@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.js',
'@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.wasm',
@ -17,11 +18,6 @@ const Assets = [
'pdfjs-dist/build/pdf.worker.js'
];
const LibarchiveWasm = [
'libarchive.js/dist/libarchive.js',
'libarchive.js/dist/libarchive.wasm'
];
const DEV_MODE = process.env.NODE_ENV !== 'production';
let COMMIT_SHA = '';
try {
@ -103,13 +99,11 @@ const config = {
};
})
}),
new CopyPlugin({
patterns: LibarchiveWasm.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './dist/libraries/wasm-gen')
};
})
// The libarchive.js worker-bundle is copied manually.
// If it is automatically bundled, escheck will fail since it uses import.meta.url.
new IgnorePlugin({
resourceRegExp: /worker-bundle\.js$/,
contextRegExp: /libarchive.js/
}),
new ForkTsCheckerWebpackPlugin({
typescript: {