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

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

Projects
None yet
@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

This comment has been minimized.

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

This comment has been minimized.

Copy link

esausilva commented Mar 27, 2018

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.

@evilebottnawi

This comment has been minimized.

Copy link
Member

evilebottnawi commented Mar 27, 2018

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

@esausilva

This comment has been minimized.

Copy link

esausilva commented Mar 27, 2018

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

@Bessonov

This comment has been minimized.

Copy link

Bessonov commented Mar 28, 2018

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

@evilebottnawi

This comment has been minimized.

Copy link
Member

evilebottnawi commented Mar 28, 2018

@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!

@gmincof

This comment has been minimized.

Copy link

gmincof commented Apr 2, 2018

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

@catamphetamine

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

amjad-eremnews added a commit to amjad-eremnews/laravel-mix-versionhash that referenced this issue Dec 12, 2018

Update index.js
the variable has some conflict with the latest version of webpack
webpack-contrib/extract-text-webpack-plugin#763
@ChhXin

This comment has been minimized.

Copy link

ChhXin commented Feb 27, 2019

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

This comment has been minimized.

Copy link

prog1dev commented Feb 28, 2019

@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

Fix CSS caching issue
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

Fix CSS caching issue
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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.