2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-10-31 16:27:46 +00:00
|
|
|
const prod = require('./webpack/webpack.build.js')
|
2021-11-08 18:06:53 +00:00
|
|
|
const { merge } = require('webpack-merge')
|
2024-04-08 17:02:56 +00:00
|
|
|
const webpack = require('webpack')
|
2021-11-08 18:39:51 +00:00
|
|
|
const path = require('path')
|
2024-04-08 17:02:56 +00:00
|
|
|
const fs = require('fs')
|
|
|
|
const locKeys = require('./loc.keys.js')
|
|
|
|
|
|
|
|
function loadLocs () {
|
|
|
|
// Loading english strings, so we can inject them as constants.
|
|
|
|
const refFile = path.resolve(__dirname, '..', '..', 'dist', 'languages', 'en.reference.json')
|
|
|
|
if (!fs.existsSync(refFile)) {
|
|
|
|
throw new Error('Missing english reference file, please run "npm run build:languages" before building ConverseJS')
|
|
|
|
}
|
|
|
|
const english = require(refFile)
|
|
|
|
|
|
|
|
const r = {}
|
|
|
|
for (const key of locKeys) {
|
|
|
|
if (!(key in english) || (typeof english[key] !== 'string')) {
|
|
|
|
throw new Error('Missing english string key=' + key)
|
|
|
|
}
|
|
|
|
r['LOC_' + key] = JSON.stringify(english[key])
|
|
|
|
}
|
|
|
|
return r
|
|
|
|
}
|
2021-11-08 18:06:53 +00:00
|
|
|
|
|
|
|
module.exports = merge(prod, {
|
2021-11-08 18:39:51 +00:00
|
|
|
entry: path.resolve(__dirname, 'custom/entry.js'),
|
2022-10-31 16:27:46 +00:00
|
|
|
output: {
|
|
|
|
filename: 'converse.min.js'
|
|
|
|
},
|
2024-04-08 17:02:56 +00:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin(loadLocs())
|
|
|
|
],
|
2021-11-08 18:06:53 +00:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js'],
|
|
|
|
alias: {
|
2022-01-07 18:20:28 +00:00
|
|
|
'./templates/muc-bottom-panel.js': path.resolve('custom/templates/muc-bottom-panel.js'),
|
2024-04-11 09:25:04 +00:00
|
|
|
'./templates/muc-head.js': path.resolve(__dirname, 'custom/templates/muc-head.js'),
|
2021-12-06 13:47:34 +00:00
|
|
|
'../../templates/background_logo.js$': path.resolve(__dirname, 'custom/templates/background_logo.js'),
|
2024-05-11 15:37:20 +00:00
|
|
|
'./templates/muc-chatarea.js': path.resolve('custom/templates/muc-chatarea.js'),
|
2024-04-11 09:25:04 +00:00
|
|
|
|
2024-04-29 14:46:21 +00:00
|
|
|
'../templates/icons.js': path.resolve(__dirname, 'custom/shared/components/font-awesome.js'),
|
|
|
|
|
2024-04-08 17:02:56 +00:00
|
|
|
'shared/styles/index.scss$': path.resolve(__dirname, 'custom/shared/styles/livechat.scss'),
|
2024-04-11 09:25:04 +00:00
|
|
|
|
2024-04-08 17:02:56 +00:00
|
|
|
'shared/modals/livechat-external-login.js': path.resolve(
|
|
|
|
__dirname,
|
|
|
|
'custom/shared/modals/livechat-external-login.js'
|
|
|
|
),
|
|
|
|
'templates/livechat-external-login-modal.js': path.resolve(
|
|
|
|
__dirname,
|
|
|
|
'custom/templates/livechat-external-login-modal.js'
|
|
|
|
),
|
|
|
|
'livechat-external-login-content.js': path.resolve(
|
|
|
|
__dirname,
|
|
|
|
'custom/livechat-external-login-content.js'
|
|
|
|
)
|
2021-11-08 18:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|