Files
bbb-plugin-test/webpack.config.js
Michelle Winkler 5e059cb98d
Some checks failed
Merge conflict check / main (push) Failing after 1m8s
i don't know what i did
2025-11-17 12:57:38 +01:00

69 lines
1.5 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = {
entry: './src/index.tsx',
output: {
filename: 'TestPlugin.js',
library: 'TestPlugin',
libraryTarget: 'umd',
publicPath: '/',
globalObject: 'this',
},
devServer: {
allowedHosts: 'all',
port: 4701,
host: '0.0.0.0',
hot: false,
liveReload: false,
client: {
overlay: false,
},
onBeforeSetupMiddleware: (devServer) => {
if (!devServer) {
throw new Error('webpack-dev-server is not defined');
}
// Serve manifest.json from the project root when requested at /manifest.json
devServer.app.get('/manifest.json', (req, res) => {
res.sendFile(path.resolve(__dirname, 'manifest.json'));
});
},
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(gif)$/i,
type: 'asset/resource',
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.tsx', '.ts'],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'manifest.json', to: './' }, // Copy manifest.json to static/ in the output folder
],
}),
],
};