Skip to content

Commit f7b2471

Browse files
committed
feat(Webpack): Add config export with named parameters.
Add config export along with the default export to support named parameters via parameter destructuring.
1 parent 1058b6d commit f7b2471

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

webpack/webpack.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const webpack_helpers = require("./webpack-helpers");
55
// plugins
66
const TerserPlugin = require("terser-webpack-plugin");
77

8-
module.exports = (env, argv, config, babel_include = [], package_json) => {
8+
const config_factory = (env, argv, config, babel_include = [], package_json) => {
99
// Webpack config
1010

1111
// Packages in node_modules to NOT exclude from babel processing.
@@ -139,3 +139,11 @@ module.exports = (env, argv, config, babel_include = [], package_json) => {
139139
}
140140
return config;
141141
};
142+
143+
// Default export
144+
const module_exports = (module.exports = config_factory);
145+
146+
// Named exports
147+
module_exports.config = ({ env, argv, config, babel_include = [], package_json }) => {
148+
return config_factory(env, argv, config, babel_include, package_json);
149+
};

0 commit comments

Comments
 (0)