83 lines
1.7 KiB
JavaScript
83 lines
1.7 KiB
JavaScript
const path = require('path')
|
|
const webpack = require('webpack')
|
|
|
|
const EsmWebpackPlugin = require('@purtuga/esm-webpack-plugin')
|
|
|
|
const packagejson = require('./package.json')
|
|
|
|
const clientFiles = [
|
|
'common-client-plugin',
|
|
'videowatch-client-plugin',
|
|
'admin-plugin-client-plugin'
|
|
]
|
|
|
|
let config = clientFiles.map(f => ({
|
|
entry: "./client/" + f + ".ts",
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader'
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'shared': path.resolve(__dirname, 'shared/')
|
|
},
|
|
extensions: [ '.tsx', '.ts', '.js' ],
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, "./dist/client"),
|
|
filename: "./" + f + ".js",
|
|
library: "script",
|
|
libraryTarget: "var"
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
PLUGIN_CHAT_PACKAGE_NAME: JSON.stringify(packagejson.name)
|
|
}),
|
|
new EsmWebpackPlugin()
|
|
]
|
|
}))
|
|
|
|
config.push({
|
|
entry: "./conversejs/builtin.ts",
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader'
|
|
}
|
|
]
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, "./dist/client/static"),
|
|
filename: "./builtin.js"
|
|
}
|
|
})
|
|
|
|
config.push({
|
|
entry: "./client/settings.ts",
|
|
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader'
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
extensions: [ '.tsx', '.ts', '.js' ],
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, "./dist/client/settings"),
|
|
filename: "./settings.js"
|
|
}
|
|
})
|
|
|
|
module.exports = config
|