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:
committed by
GitHub
parent
1a8d354945
commit
3eba8525da
@@ -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
|
||||
],
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user