1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Rework Webpack config

This commit is contained in:
MrTimscampi 2020-08-15 12:44:52 +02:00 committed by vitorsemeano
parent bfb8c7c1f6
commit 96eccd2ecd
7 changed files with 1034 additions and 1236 deletions

View file

@ -1,57 +1,19 @@
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const WorkerPlugin = require('worker-plugin');
const Assets = [
'alameda/alameda.js',
'native-promise-only/npo.js',
'libarchive.js/dist/worker-bundle.js',
'libass-wasm/dist/js/subtitles-octopus-worker.js',
'libass-wasm/dist/js/subtitles-octopus-worker.data',
'libass-wasm/dist/js/subtitles-octopus-worker.wasm',
'libass-wasm/dist/js/subtitles-octopus-worker-legacy.js',
'libass-wasm/dist/js/subtitles-octopus-worker-legacy.data',
'libass-wasm/dist/js/subtitles-octopus-worker-legacy.js.mem',
'pdfjs-dist/build/pdf.worker.js'
];
const LibarchiveWasm = [
'libarchive.js/dist/wasm-gen/libarchive.js',
'libarchive.js/dist/wasm-gen/libarchive.wasm'
];
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: './bundle.js',
stats: 'errors-only',
target: 'web',
resolve: {
modules: [
path.resolve(__dirname, 'node_modules')
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'amd-require'
},
plugins: [
new CopyPlugin(
Assets.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './dist/libraries')
};
})
),
new CopyPlugin(
LibarchiveWasm.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './dist/libraries/wasm-gen/')
};
})
),
new WorkerPlugin()
]
(new CleanWebpackPlugin())
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
}
};