From 18d051a82db3f1b8d03b2839a72d83ced979cfc8 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 21 Mar 2018 20:08:46 +0200 Subject: [PATCH] chore: add BannerPlugin --- webpack.config.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/webpack.config.ts b/webpack.config.ts index 20e59b8d..abc5a1d1 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -16,6 +16,13 @@ const REVISION = JSON.stringify( .trim(), ); +const BANNER = + `ReDoc - OpenAPI/Swagger-generated API Reference Documentation +------------------------------------------------------------- + Version: ${VERSION} + Repo: https://github.com/Rebilly/ReDoc`; + + export default (env: { standalone?: boolean } = {}) => ({ entry: env.standalone ? ['./src/polyfills.ts', './src/standalone.tsx'] : './src/index.ts', output: { @@ -44,14 +51,14 @@ export default (env: { standalone?: boolean } = {}) => ({ externals: env.standalone ? { - esprima: 'esprima', - 'node-fetch': 'null', - } + esprima: 'esprima', + 'node-fetch': 'null', + } : (context, request, callback) => { - // ignore node-fetch dep of swagger2openapi as it is not used - if (/node-fetch$/i.test(request)) return callback(null, 'var undefined'); - return nodeExternals(context, request, callback); - }, + // ignore node-fetch dep of swagger2openapi as it is not used + if (/node-fetch$/i.test(request)) return callback(null, 'var undefined'); + return nodeExternals(context, request, callback); + }, module: { rules: [ @@ -99,5 +106,6 @@ export default (env: { standalone?: boolean } = {}) => ({ __REDOC_REVISION__: REVISION, }), new ForkTsCheckerWebpackPlugin({ silent: true }), + new webpack.BannerPlugin(BANNER) ], });