-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add preset configuration support to webpack #17171
base: main
Are you sure you want to change the base?
Conversation
For maintainers only:
|
@alexander-akait @TheLarkInn @snitin315 let me know your thoughts on this. if this is not the approach we want to take, i'll drop this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@burhanuday there's one scenario that I recall @patak-dev called out to me when discussing this feature. I believe that Rollup/Vite has the ability to have -plugin
's be a collection of applied plugins.
What I would like to see is a adding a test case that covers a variety of scenarios where:
- One preset adds transitively multiple presets
- Preset A => Preset B => Preset C
- Potentially mitigating some merge cases (but maybe thats a webpack-merge scenario) or custom logic in the Processor
@TheLarkInn added a complex working example with the situation you mentioned above The
|
Opened a PR in webpack-merge to deep merge loader options - survivejs/webpack-merge#206 |
The webpack-merge PR has been merged. It means that options will now be deep merged. This approach is viable 馃帀 |
@TheLarkInn friendly ping here |
Let's rebase @burhanuday and this is going through review here this week. Appreciate the patience and work on this. 馃憦 |
@ Thanks for your update. I labeled the Pull Request so reviewers will review it again. @TheLarkInn Please review the new changes. |
Summary
Motivation:
Currently, setting up Webpack configurations can be a time-consuming process, especially for new users. By introducing preset support, we aim to simplify this process and provide a more streamlined experience. Users can select a preset that aligns with their project requirements, reducing the need to write complex configurations from scratch.
This PR introduces a new feature to Webpack, allowing users to add presets as their configuration. A preset is a base configuration that can be extended from, providing a convenient way for users to set up their projects quickly and efficiently.
馃 Generated by Copilot at 15be2ad
This pull request adds a new feature to support
Presets
in webpack configuration.Presets
are arrays of predefined options that can be applied to the whole configuration or to individual configurations in an array. The pull request introduces a new classPresetProcessor
that uses thewebpack-merge
module to merge the preset configurations into the webpack options object. It also updates thelib/webpack.js
,schemas/WebpackOptions.json
,lib/config/normalization.js
,.eslintignore
,package.json
, andpackage-lock.json
files to enable and support the new feature.Details
The syntax i am working towards is:
so that the usage looks something like this
This opens up the possibility to pass an options object to the plugin
馃 Generated by Copilot at 15be2ad
.mjs
files from linting process (link)webpack-merge
dependency topackage.json
(link)