Created
July 9, 2018 12:06
-
-
Save TheLarkInn/684bcdb5cf3a082c5a3cee907168c59a to your computer and use it in GitHub Desktop.
Load Preset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpackMerge = require("webpack-merge"); | |
const applyPresets = (env = { presets: [] }) => { | |
const presets = env.presets || []; | |
/** @type {string[]} */ | |
const mergedPresets = [].concat(...[presets]); | |
const mergedConfigs = mergedPresets.map(presetName => require(`./presets/webpack.${presetName}`)(env)); | |
return webpackMerge({}, ...mergedConfigs); | |
}; | |
module.exports = applyPresets; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@TheLarkInn, can you please provide a full example on how this can be used with the webpack.config.js ? Thanks