Files
bbb-plugin-test/webpack.config.js
Guilherme Pereira Leme 3eba8525da ref: Update template to use the new plugin manifest structure (#10)
* [manifest-structure] - added manifest structure to template

* Update README.md

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>

---------

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>
2024-10-29 16:12:23 -04:00

65 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: '<plugin-name>.js',
library: '<plugin-name>',
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/,
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.tsx', '.ts'],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'manifest.json', to: './' }, // Copy manifest.json to static/ in the output folder
],
}),
],
};