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

Cannot Remove bundled hash in filename of CSS #886

Closed
RaghulXander opened this issue Sep 11, 2019 · 5 comments
Closed

Cannot Remove bundled hash in filename of CSS #886

RaghulXander opened this issue Sep 11, 2019 · 5 comments
Labels

Comments

@RaghulXander
Copy link

Bug
The reason for below change is i can't update the hashed css file name is other's website every time it gets builded**

Currently filename: '[name].[contenthash:5].css' for isProd

I cannot override the above file name in preact.config.js as per below code

const cssExtractPlugin = helpers.getPluginsByName(config, "MiniCssExtractPlugin")
cssExtractPlugin.forEach(
    ({ plugin }) =>
      (plugin.options.filename = "widget.css")
  );

The above change is ignored and bundle.31cd2.css is generated as-usual

My expected behaviour is to generate widget.css

Note: If it's the usual behaviour please guide me in updating file remotely.

@RaghulXander RaghulXander changed the title Cannot Remove bundled hash in filename for CSS Cannot Remove bundled hash in filename of CSS Sep 11, 2019
@prateekbh
Copy link
Member

Can u try with --no-esm?

@RaghulXander
Copy link
Author

Getting this error with help commands Unknown argument: esm
Cannot find esm in the help commands.

"preact-cli": "^3.0.0-rc.2",

@bojan88
Copy link

bojan88 commented Sep 18, 2019

@RaghulXander try this:

const { plugin: cssExtractPlugin } = helpers.getPluginsByName(config, 'MiniCssExtractPlugin')[0];
cssExtractPlugin.options.moduleFilename = () => 'widget.css';
cssExtractPlugin.options.filename = 'widget.css';

It should work both in 3.0.0-rc.2 and 3.0.0-rc.5 (latest at the time of writting).

@RaghulXander
Copy link
Author

Thanks @bojan88..... It worked like charm

So the thing is i need to change moduleFilename along with filename ?

@bojan88
Copy link

bojan88 commented Sep 23, 2019

@RaghulXander I guess this issue is present in mini-css-extract-plugin v0.7.0 and v0.8.0, and will be fixed in next release.
You can find out more in webpack-contrib/mini-css-extract-plugin#430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants