question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Remove bundled hash in filename of CSS

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
bojan88commented, 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).

1reaction
bojan88commented, 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 https://github.com/webpack-contrib/mini-css-extract-plugin/pull/430

Read more comments on GitHub >

github_iconTop Results From Across the Web

vite without hash in filename - Stack Overflow
I needed to add output: {entryFileNames: "[name].js",... Still working on getting a single file.
Read more >
Adding Hashes to Filenames - SurviveJS
If only main bundle gets updated, only that file needs to be requested again. The same result can be achieved by generating static...
Read more >
MiniCssExtractPlugin - webpack
In the example below, we'll use filename to output the generated css into a different directory. webpack.config.js const MiniCssExtractPlugin = require("mini- ...
Read more >
Adding Hashes to Filenames | webpack surviveJS
The files have neat hashes now. To prove that it works for styling, you could try altering src/main.css and see what happens to...
Read more >
HTML and Static Assets - Vue CLI
... asset links for the JavaScript and CSS files produced during the build. ... hashes in filenames filenameHashing: false, // delete HTML ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found