Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to mini-css-extract-plugin from extract-text-webpack-plugin #1062

Merged
merged 3 commits into from Oct 2, 2018
Merged

Migrate to mini-css-extract-plugin from extract-text-webpack-plugin #1062

merged 3 commits into from Oct 2, 2018

Conversation

sibiraj-s
Copy link
Contributor

@sibiraj-s sibiraj-s commented Sep 29, 2018

Migrated from ETWP to mini-css-extract-plugin. Webpack discourages the use of ETWP since webpack 4.0

Since mini-css-extract-plugin requires webpack>4.4, hence webpack is updated.
Which inturn causes conflicts with contenthash so to fix tests. I renamed it to templatehash.. I can't think of more suitable name than this.

Breaking: contenthash is renamed to templatehash

@jantimon
Copy link
Owner

jantimon commented Oct 1, 2018

Sorry this pr includes too many features and also some quite opinionated ones

Please ping me for a discussion so we can find out which features we are going to merge :)

@jantimon jantimon closed this Oct 1, 2018
@sibiraj-s
Copy link
Contributor Author

sibiraj-s commented Oct 1, 2018

@jantimon What about migrating to mini-css-extract-plugin?

Can you point out the opinionated changes. So that I could revert them. I made few changes that are commonly found in many open source libs.

@edmorley
Copy link
Contributor

edmorley commented Oct 1, 2018

In general it's best to keep to one type of change per PR. Looking at the changes here, I see linting fixes, gitignore changes, test cleanups, dependency bumps, deleting dist folders and the switch to mini-css-extract-plugin. Each of those should likely be a separate PR - which then makes it simpler to review/discuss :-)

@sibiraj-s
Copy link
Contributor Author

sibiraj-s commented Oct 1, 2018

Yes @edmorley My bad. I thought these changes will be good. but separate PR should do.

@jantimon can you reopen the PR. I will update this to the change with original intention

shifting from ETWP ->mini-css-extract-plugin

@jantimon jantimon reopened this Oct 1, 2018
BREAKING: `contenthash` in now `templatehash`. Since webpack 4.3 `contenthash` is used by webpack. to avoid conflicts, it is renamed to `templatehash`
@sibiraj-s
Copy link
Contributor Author

sibiraj-s commented Oct 1, 2018

@jantimon @edmorley Updated the changes and description. This includes dist/ folder which is auto-generated

{ test: /\.png$/, loader: 'file-loader' }
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'template.html'
}),
new ExtractTextPlugin('styles.css')
new MiniCssExtractPlugin({ filename: 'style.css' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change style.css back to styles.css (here and elsewhere) to reduce the size of the diff? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, too many diff. I missed that. Updated now

Checkout #1064

@@ -279,10 +279,10 @@ class HtmlWebpackPlugin {
return self.options.showErrors ? prettyError(err, compiler.context).toHtml() : 'ERROR';
})
.then(html => {
// Allow to use [contenthash] as placeholder for the html-webpack-plugin name
// Allow to use [templatehash] as placeholder for the html-webpack-plugin name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since mini-css-extract-plugin requires webpack>4.4. which use contenthash internally. that conflicts with what we use. Hence I renamed that.

contenthash was introduced in webpack 4.3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense. I guess this change fixes #1033.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Just noticed there is also another PR #1034 does the same.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's fine for me - maybe we could also replace contenthash to templatehash before we compile it.
So users will be able to use contenthash and templatehash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. So that no breaking change will be introduced. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jantimon checkout #1065

@sibiraj-s
Copy link
Contributor Author

What about updating webpack in peerDependency to >= 4.4 as mini-css plugin. these plugins will be used together mostly

@jantimon jantimon merged commit f4bccb7 into jantimon:webpack-4 Oct 2, 2018
@jantimon
Copy link
Owner

jantimon commented Oct 2, 2018

Thanks alot 👍

@sibiraj-s sibiraj-s deleted the patch-3 branch October 2, 2018 09:08
@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants