Webpack-cli: Migrate and init should move to mini-css-extract-plugin

Created on 5 Apr 2018  路  16Comments  路  Source: webpack/webpack-cli

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
At the moment, when migrating or initiating a new configuration ExtractTextPlugin it still uses ExtractTextPlugin. ExtractTextPlugin should become MiniCssExtractPlugin

What is the expected behavior?
The cli should ask it the user wants to migrate to v3 or v4 of webpack. If v4, it should migrate to MiniCssExtractPlugin. The init feature should use MiniCssExtractPlugin as well.

If this is a feature request, what is motivation or use case for changing the behavior?
Supporting the new MiniCssExtractPlugin

Feature Request Help Wanted Init Migrate

Most helpful comment

I also think that the usage of webpack v1 is now deprecated.
Yeah, I think we should just focus from v3 to v4

All 16 comments

Do we want to keep v1->v2 migration or deprecate it and just have v3->v4?

Honestly I'd propose a breaking change and going straight from v3 to v4

Sounds reasonable!

I'll work on this feature if no one else has started it.

@bitpshr Thanks! You can pick it up! Consider that half of the job is already done here #363
You'd just need to work on the migrate part

@ematipico To confirm, we should be replacing the existing v1 -> v2 ExtractTextPlugin transform with a v3 -> v4 transform that switches ExtractTextPlugin with MiniCssExtractPlugin? Are other transforms also v3 - v4 now and not v1 -> v2?

@bitpshr yes, we are creating a breaking change here. V3->V4. Yes again, Change extract-text to mini-css.
I don't really think that there are any more needed changes

Exactly. Inside the migrate folder we have all the configuration options that we currently support. That's a meaty change and we have also add snapshot tests. Ideally you could also make WIP PR if you require some help or advice

Thanks @ematipico and @PlayMa256. I've completed an initial upgrade of the ExtractTextPlugin transformation on my branch. It now transforms v3 configuration to v4 instead of v1 to v2 and uses MiniCssExtractPlugin.

Was the intention to use this issue / PR to track all other transformation upgrades as well, or should I submit my PR as-is and we can open individual tickets for remaining v3 -> v4 changes?

Just open a pr for that. Since this issue just refeers to miniCss lets stick with that. If any other transformations are required, we can open more.

After an internal discussion about the migrate, where the intention is to _migrate the configuration always the most up to date version_, so in this case webpack 4, I think that a breaking change is not necessary and we should move straight to MiniCssExtractPlugin. What do you guys think?

Well, this is sort of a "breaking change" anyways, since we are removing the option to migrate to older versions. And yes, i started touching onto some files, but bitshr already said he would like to work, so i let him do that and my initial idea was to remove the extractTextPlugin folder and have just a miniCssExtractPlugin folder and in there all these transformations. In this way it would be much cleaner.

@bitpshr could you move all this code to a miniCssExtractPlugin folder? That would be much more cleaner for future devs.

@ematipico @PlayMa256 I agree that we should always migrate to the latest version, but do we support migrating from v1 -> v4, v2 -> v4, and v3 -> v4, or just v3 -> v4? If we decide to make our transformations be able to upgrade _any_ previous version to the latest version, the AST logic will get incredibly complex.

I vote that we move to actively support upgrading the previous version to the latest version, so v3 -> v4 in this case. When v5 is released, we should upgrade our transforms to instead support upgrading v4 - v5, and so on.

I made the same question, when i first read this issue.
ematipico answer was:

Honestly I'd propose a breaking change and going straight from v3 to v4

You comment resonates with what he said, and i do agree too. Let's just support newest versions of the webpack config, otherwise the whole migration folder would be such a mess.

I also think that the usage of webpack v1 is now deprecated.
Yeah, I think we should just focus from v3 to v4

Sounds good to me. PR submitted for the extractTextPlugin transform. Issues opened to track updates to the remaining transforms as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

billyjanitsch picture billyjanitsch  路  3Comments

jbottigliero picture jbottigliero  路  5Comments

RobotnickIsrael picture RobotnickIsrael  路  5Comments

evenstensberg picture evenstensberg  路  5Comments

anyulled picture anyulled  路  4Comments