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