Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Error: Path variable [contenthash] not implemented in this context: style/[name].[contenthash].css #763

Closed
moorthy-g opened this issue Mar 27, 2018 · 12 comments

Comments

@moorthy-g
Copy link

moorthy-g commented Mar 27, 2018

I get the following error after webpack upgrade (4.3.0)
Error: Path variable [contenthash] not implemented in this context: style/[name].[contenthash].css

My plugin config is

new ExtractTextWebpackPlugin({
    filename: 'style/[name].[contenthash].css'
})

extract-text-webpack-plugin's version is 4.0.0-beta.0.

Its working good with webpack 4.1.0 though.

@Alorel
Copy link

Alorel commented Mar 27, 2018

This appears to be a conflict with webpack 4.3 which introduced a [contenthash] variable of its own: https://github.com/webpack/webpack/releases/tag/v4.3.0

@esausilva
Copy link

I just upgraded to Webpack 4.3 and got the same error. I hope this gets fixed, but for the moment I changed [contenthash] to [hash] to get it working again.

@alexander-akait
Copy link
Member

Please use https://github.com/webpack-contrib/mini-css-extract-plugin for extract css for webpack@4

@esausilva
Copy link

@evilebottnawi Thanks. I will give it a try once it supports HMR

@Bessonov
Copy link

@evilebottnawi does it mean that extract-text-webpack-plugin is deprecated at least for css?

@alexander-akait
Copy link
Member

@Bessonov yes, future ETWP is only extracted content without features like ordering, code splitting, tree shaking, purifying or other specific action for each type of assets (i.e. css/html/etc). Just extract. Thanks!

@georgemincof
Copy link

A temporary solution that you can use until it's fixed, is to replace [contenthash] with something like [md5:contenthash:hex:20].

@catamphetamine
Copy link

catamphetamine commented Apr 4, 2018

If you're getting this with mini-css-extract-plugin then update it and the error disappears:

npm install mini-css-extract-plugin@latest --save

webpack-contrib/mini-css-extract-plugin#63

@jalmansa88
Copy link

jalmansa88 commented Aug 2, 2018

I still have this error. I ran npm install mini-css-extract-plugin@latest --save and still hapenning when au build --env prod. Only doing the change [md5:contenthash:hex:20] fixed the error.

@DavOnGit
Copy link

DavOnGit commented Sep 2, 2018

@esausilva You can check extract-css-chunks-webpack-plugin it supports HMR!

ghettovoice added a commit to ghettovoice/vuelayers-demo that referenced this issue Oct 26, 2018
dev-erem added a commit to dev-erem/laravel-mix-versionhash that referenced this issue Dec 12, 2018
the variable has some conflict with the latest version of webpack
webpack-contrib/extract-text-webpack-plugin#763
@xinchanghao
Copy link

I just upgraded to Webpack 4.3 and got the same error. I hope this gets fixed, but for the moment I changed [contenthash] to [hash] to get it working again.

thanks,resolved

@prog1dev
Copy link

@evilebottnawi Thanks. I will give it a try once it supports HMR

Why would you use extract-text-webpack-plugin in development?

You dont need HMR in production so switching to https://github.com/webpack-contrib/mini-css-extract-plugin is okay

gberaudo added a commit to camptocamp/ngeo that referenced this issue Mar 21, 2019
When the only changes are HTML or CSS the hash was not updated.
This commit should fix the issue.

For why hash is used instead of contenthash, see webpack-contrib/extract-text-webpack-plugin#763 (comment).
gberaudo added a commit to camptocamp/ngeo that referenced this issue Mar 21, 2019
When the only changes are HTML or CSS the hash was not updated.
This commit should fix the issue.

For why hash is used instead of contenthash, see webpack-contrib/extract-text-webpack-plugin#763 (comment).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests