jellyfin-web/webpack.common.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-05-04 03:44:12 -07:00
const path = require('path');
2019-11-10 09:45:01 -07:00
2020-05-04 03:44:12 -07:00
const CopyPlugin = require('copy-webpack-plugin');
2020-05-29 14:32:45 -07:00
const WorkerPlugin = require('worker-plugin');
2019-11-10 09:45:01 -07:00
2019-11-06 17:02:32 -07:00
const Assets = [
2020-05-04 03:44:12 -07:00
'alameda/alameda.js',
'native-promise-only/npo.js',
2020-05-29 14:32:45 -07:00
'libarchive.js/dist/worker-bundle.js',
2020-05-04 03:44:12 -07:00
'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',
2020-09-01 06:55:08 -07:00
'libass-wasm/dist/js/subtitles-octopus-worker-legacy.js.mem',
'pdfjs-dist/build/pdf.worker.js'
2019-11-06 17:02:32 -07:00
];
2020-05-29 14:32:45 -07:00
const LibarchiveWasm = [
'libarchive.js/dist/wasm-gen/libarchive.js',
'libarchive.js/dist/wasm-gen/libarchive.wasm'
];
module.exports = {
2020-05-04 03:44:12 -07:00
context: path.resolve(__dirname, 'src'),
entry: './bundle.js',
stats: 'errors-only',
resolve: {
modules: [
2020-05-04 03:44:12 -07:00
path.resolve(__dirname, 'node_modules')
]
2019-05-24 21:28:06 -07:00
},
2020-02-28 06:36:42 -07:00
output: {
2020-05-04 03:44:12 -07:00
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'amd-require'
2020-02-28 06:36:42 -07:00
},
2019-09-30 16:58:05 -07:00
plugins: [
new CopyPlugin(
Assets.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
2020-05-04 03:44:12 -07:00
to: path.resolve(__dirname, './dist/libraries')
};
})
2020-05-29 14:32:45 -07:00
),
new CopyPlugin(
LibarchiveWasm.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './dist/libraries/wasm-gen/')
};
})
),
new WorkerPlugin()
2019-09-30 16:58:05 -07:00
]
};