Webpack-cli: feature: new init generator

Created on 10 Feb 2021  Â·  15Comments  Â·  Source: webpack/webpack-cli

Is your feature request related to a problem? Please describe.
Currently, the init generation is a bad DX with support for custom scaffolds completely broken.

Describe the solution you'd like
Generate pre-defined configurations instead of creating one using AST transforms. The implementation will be done in steps:

  • [x] Simplify the generation flow for init (#2429)
  • [x] Add default template for init (#2429)
  • [x] Add tests for init
  • [x] Update documentation

Describe alternatives you've considered
N/A

Additional context

2409

/cc @webpack/cli-team

Feature Request

All 15 comments

After this we should not have jscodeshift in our deps

Also we should always generate webpack.config.js

And we should not exist with -1 code when somebody press CRTL + C on init (try it using npm init)

@rishabh3112 What is status? I want to finish it for the next release

@rishabh3112 What is status? I want to finish it for the next release

It works as we need. I have added tests as well. Will rebase and then we can merge it.

@rishabh3112 Do we drop jscodeshift from our deps?

@rishabh3112 Do we drop jscodeshift from our deps?

Yup its not needed now for init. Will remove it from deps as well.

Status

  1. Simplification of code structure done
  2. Created default template
  3. Testing is done as well
  4. Questioning for webpack configuration done.
  5. Documentations done.

All done ✨
Will be adding more templates for react, vue, node-packages etc in further PRs 😎

Now available in latest release ✅

TODO: Adding templates for common usecases (https://github.com/webpack/webpack-cli/issues/2430#issuecomment-793683956) - WIP

Todo

  • [x] Add support to add varied options as per mode (eg. css-minimizer-webpack-plugin only in production)
  • [x] Update Mini-CSS-extract-plugin configuration after above change. For example:
    Do you want to extract CSS for every file? <ul> <li>Yes</li> <li>Only for production</li> <li>No<br />

PWA support too?

Do you need plugin for service workers?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sumukhah picture sumukhah  Â·  3Comments

AjayPoshak picture AjayPoshak  Â·  5Comments

luillyfe picture luillyfe  Â·  4Comments

RobotnickIsrael picture RobotnickIsrael  Â·  5Comments

evenstensberg picture evenstensberg  Â·  5Comments