3

When i try to generate production build, it generates chunks with hash. I do not want that hash to be included in the chunks (Shown in below attached screenshot). How i can achieve that.?

Chunks from npm run build

Chunks from npm run build

2 Answers 2

3

Ideally hashing help to identify if the newer version on the file is avaliable and to fetch the latest version, however, if you still want to disable hash output, try

npm run build --output-hashing=none

Sign up to request clarification or add additional context in comments.

Comments

1

Hope this helps: https://webpack.js.org/guides/caching/#output-filenames

const path = require('path');
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');

  module.exports = {
    entry: './src/index.js',
    plugins: [
      // new CleanWebpackPlugin(['dist/*']) for < v2 versions of CleanWebpackPlugin
      new CleanWebpackPlugin(),
      new HtmlWebpackPlugin({
       title: 'Output Management',
      }),
    ],
    output: {
-     filename: '[name].[contenthash].js',
+     filename: 'bundle.js',
      path: path.resolve(__dirname, 'dist'),
    },
  };

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.