From f1f25f4764dd8d297a59765b0df85f55da2b39ee Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Mon, 19 Jul 2021 21:08:50 -0500 Subject: Init --- plugins/pluginFactory.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/pluginFactory.js (limited to 'plugins/pluginFactory.js') diff --git a/plugins/pluginFactory.js b/plugins/pluginFactory.js new file mode 100644 index 0000000..385361f --- /dev/null +++ b/plugins/pluginFactory.js @@ -0,0 +1,16 @@ +const pluginFactory = (configure) => (nextConfig = {}) => { + return Object.assign({}, nextConfig, { + webpack(config, options) { + + configure(config, options); + + if(typeof nextConfig.webpack === 'function') { + return nextConfig.webpack(config, options); + } + + return config; + } + }); +} + +module.exports = pluginFactory; \ No newline at end of file -- cgit v1.2.3