2021-04-12 13:08:05 +00:00
|
|
|
const path = require('path')
|
|
|
|
const webpack = require('webpack')
|
2019-11-19 16:08:04 +00:00
|
|
|
|
2021-04-12 13:08:05 +00:00
|
|
|
const EsmWebpackPlugin = require('@purtuga/esm-webpack-plugin')
|
|
|
|
|
|
|
|
const packagejson = require('./package.json')
|
2019-11-19 16:08:04 +00:00
|
|
|
|
2020-08-21 12:47:09 +00:00
|
|
|
const clientFiles = [
|
2021-04-07 16:14:58 +00:00
|
|
|
'common-client-plugin',
|
|
|
|
'videowatch-client-plugin'
|
2020-08-21 12:47:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
let config = clientFiles.map(f => ({
|
2021-04-07 16:14:58 +00:00
|
|
|
entry: "./client/" + f + ".ts",
|
2021-04-10 01:22:55 +00:00
|
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
2021-04-07 16:14:58 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2021-04-09 11:06:56 +00:00
|
|
|
resolve: {
|
|
|
|
extensions: [ '.tsx', '.ts', '.js' ],
|
|
|
|
},
|
2019-11-19 16:08:04 +00:00
|
|
|
output: {
|
2021-04-07 13:53:22 +00:00
|
|
|
path: path.resolve(__dirname, "./dist/client"),
|
2021-04-07 16:14:58 +00:00
|
|
|
filename: "./" + f + ".js",
|
2019-11-19 16:08:04 +00:00
|
|
|
library: "script",
|
|
|
|
libraryTarget: "var"
|
|
|
|
},
|
2021-04-12 13:08:05 +00:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
PLUGIN_CHAT_PACKAGE_NAME: JSON.stringify(packagejson.name)
|
|
|
|
}),
|
|
|
|
new EsmWebpackPlugin()
|
|
|
|
]
|
2020-08-21 12:47:09 +00:00
|
|
|
}))
|
2019-11-19 16:08:04 +00:00
|
|
|
|
2021-02-20 19:42:41 +00:00
|
|
|
config.push({
|
2021-02-20 22:12:12 +00:00
|
|
|
entry: "./conversejs/builtin.js",
|
2021-04-10 01:22:55 +00:00
|
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
2021-02-20 19:42:41 +00:00
|
|
|
output: {
|
2021-04-07 13:53:22 +00:00
|
|
|
path: path.resolve(__dirname, "./dist/client/static"),
|
2021-02-20 22:12:12 +00:00
|
|
|
filename: "./builtin.js"
|
2021-02-20 19:42:41 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-04-09 19:28:16 +00:00
|
|
|
config.push({
|
|
|
|
entry: "./client/settings.ts",
|
2021-04-10 01:22:55 +00:00
|
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
2021-04-09 19:28:16 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: [ '.tsx', '.ts', '.js' ],
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "./dist/client/settings"),
|
|
|
|
filename: "./settings.js"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-11-19 16:08:04 +00:00
|
|
|
module.exports = config
|