aboutsummaryrefslogtreecommitdiff
path: root/plugins/pluginFactory.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pluginFactory.js')
-rw-r--r--plugins/pluginFactory.js16
1 files changed, 16 insertions, 0 deletions
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