2024-06-28 18:08:44 +03:00
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
*/
|
2024-08-22 19:38:14 +03:00
|
|
|
const webpack = require('webpack')
|
2020-08-12 14:17:28 +03:00
|
|
|
const webpackConfig = require('@nextcloud/webpack-vue-config')
|
2024-07-09 20:33:18 +03:00
|
|
|
// eslint-disable-next-line n/no-extraneous-require
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
|
|
const WebpackSPDXPlugin = require('./build-js/WebpackSPDXPlugin.js')
|
2020-08-12 14:17:28 +03:00
|
|
|
const path = require('path')
|
2024-08-22 19:38:14 +03:00
|
|
|
const { readdirSync } = require('fs')
|
|
|
|
|
|
|
|
const l10nContent = readdirSync(path.resolve(__dirname, 'js', 'pdfjs', 'web', 'locale'))
|
2020-08-12 14:17:28 +03:00
|
|
|
|
|
|
|
webpackConfig.entry.workersrc = path.resolve(path.join('src', 'workersrc.js'))
|
2020-08-13 17:18:30 +03:00
|
|
|
webpackConfig.entry.public = path.resolve(path.join('src', 'public.js'))
|
2023-02-02 12:57:04 +03:00
|
|
|
|
|
|
|
// keep pdfjs vendor in the js folder
|
|
|
|
webpackConfig.output.clean = false
|
|
|
|
|
2024-08-22 19:38:14 +03:00
|
|
|
// Add list of PDFjs supported languages
|
|
|
|
webpackConfig.plugins.push(
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
SUPPORTED_LANGUAGES: JSON.stringify(l10nContent),
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2024-07-09 20:33:18 +03:00
|
|
|
webpackConfig.optimization.minimizer = [new TerserPlugin({
|
|
|
|
extractComments: false,
|
|
|
|
terserOptions: {
|
|
|
|
format: {
|
|
|
|
comments: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})]
|
|
|
|
|
2024-07-03 16:39:13 +03:00
|
|
|
webpackConfig.plugins = [
|
|
|
|
...webpackConfig.plugins,
|
|
|
|
// Generate reuse license files
|
|
|
|
new WebpackSPDXPlugin({
|
|
|
|
override: {
|
|
|
|
// TODO: Remove if they fixed the license in the package.json
|
|
|
|
'@nextcloud/axios': 'GPL-3.0-or-later',
|
|
|
|
'@nextcloud/vue': 'AGPL-3.0-or-later',
|
|
|
|
'nextcloud-vue-collections': 'AGPL-3.0-or-later',
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
|
2020-08-12 14:17:28 +03:00
|
|
|
module.exports = webpackConfig
|