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>
This commit is contained in:
Guilherme Pereira Leme
2024-10-29 17:12:23 -03:00
committed by GitHub
parent 1a8d354945
commit 3eba8525da
7 changed files with 10380 additions and 27 deletions

View File

@@ -1,21 +1,35 @@
/* 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: '<PluginName>.js',
library: '<PluginName>',
filename: '<plugin-name>.js',
library: '<plugin-name>',
libraryTarget: 'umd',
publicPath: '/static/',
publicPath: '/',
globalObject: 'this',
},
devServer: {
allowedHosts: 'all',
port: 4701,
host: 'localhost',
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: [
@@ -40,4 +54,11 @@ module.exports = {
resolve: {
extensions: ['.js', '.jsx', '.tsx', '.ts'],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'manifest.json', to: './' }, // Copy manifest.json to static/ in the output folder
],
}),
],
};