Is your feature request related to a problem? Please describe.
Not a problem, but a nice to have.
Lot of time people have different configuration file based on different environment or situation and sometimes they like to put the 'shared' configuration inside a specific file (webpack.base.js, something like this). It would nice if the webpack-cli would provide an automatic way to extend from a base file.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Usage scenarios:
// webpack.base.js
module.exports = {
entry: {
foo: './src/foo.js',
bar: './src.bar.js'
},
output: {
filename: [name].js
}
}
// webpack.dev.js
module.exports = {
mode: 'development',
plugins: [
new DefinePlugin() // anything
]
}
webpack --config webpack.dev.js --extend webpack.base.js
Or
// inside webpack.dev.js
module.exports = {
extend: './webpack.base.js',
mode: 'development',
plugins: [
new DefinePlugin() // anything
]
}
Do you mean like this? https://github.com/survivejs/webpack-merge
Yes something similar, but supported at CLI level
I would like to work on this feature, if no one has taken this up already.
Feel free to 馃馃徑
As seen in webpack-command: https://github.com/webpack-contrib/webpack-command#extendable-webpack-configurations :+1:
This is possible. Gonna do this in the new cli version
I really like the way this is done by the now deprecated config-loader: https://webpack.js.org/loaders/config-loader/#extending-configuration-files
Its really clean and obvious which files are extending what. If webpack-cli could do this in a similar way that would be awesome.
Send a PR and it could be added pretty fast 馃馃徑
I wrongly reported this issue into webpack repo (issue).
Most of the tools in the stack support "extends", even it was available on "webpack-command", and today shown in webpack documentation as possible (but it is not).
Examples: tslint, jest, eslint, babel.
It is possible via config-loader. What's need to be done in here and to use via cli and also being able to use config-loader inside our code. Like webpack command does
Think I'd like to work on this (for my first contribution as well :) Would you be able to elaborate on exactly what you mean @ematipico by:
What's need to be done in here and to use via cli and also being able to use config-loader inside our code. Like webpack command does
What this consists of is to merge the configuration you are provided as an option with this one given as a flag
This is being resolved at #527
This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days.
I am now using webpack-merge as an alternative but it would be cool to have this feature integrated the same way webpack-command CLI did with the extends property.
Most helpful comment
I really like the way this is done by the now deprecated config-loader: https://webpack.js.org/loaders/config-loader/#extending-configuration-files
Its really clean and obvious which files are extending what. If webpack-cli could do this in a similar way that would be awesome.