Giter Site home page Giter Site logo

Comments (4)

 avatar commented on August 15, 2024 3

Indeed, incorrect settings for this project.

threshold: 0,
minRatio: 1,
...

All is well! Thank you!

from compression-webpack-plugin.

alexander-akait avatar alexander-akait commented on August 15, 2024

@MCMeGa can you create minimum reproducible test repo?

from compression-webpack-plugin.

 avatar commented on August 15, 2024

I can not. I can show the full file webpack.config.js

const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const PostCSSAssetsPlugin = require("postcss-assets-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = function (env) {
  const outputPath = path.join(__dirname, "../MultiSwitch_ESP/data");
  const exports = {
    cache: true,
    entry: {
      main: "./src/index"
    },
    output: {
      path: outputPath,
      filename: "[name].js",
      publicPath: "/"
    },
    plugins: [
      new CleanWebpackPlugin(path.join(outputPath, "*"), {root: path.join(__dirname, ".."), verbose: false}),
      new webpack.NoEmitOnErrorsPlugin(),
      new ExtractTextPlugin("style.css"),
      new PostCSSAssetsPlugin({
        test: /\.css$/,
        log: false,
        plugins: [
          require("precss"),
          require("autoprefixer")
        ],
      })
    ],
    module: {
      rules: [
        {
          test: /\.(jsx|js)$/,
          loader: "babel-loader",
          include: [path.resolve(__dirname, "src")],
          exclude: /(node_modules|bower_components)/,
          options: {cacheDirectory: path.resolve(__dirname, "babel_cache/")}
        },
        {
          test: /\.s?css$/,
          use: ExtractTextPlugin.extract({
            fallback: "style-loader",
            use: ["css-loader", "sass-loader"]
          })
        },
        {
          test: /\.(json)$/,
          loader: "json-loader"
        }
      ]
    }
  };
  const copyTargets = [ {from: 'src/static/', to: './'} ];
  exports.plugins.push(new CopyWebpackPlugin(copyTargets));
  if (env && env.compress) {
    exports.plugins.push(new CompressionPlugin({
      asset: "[path].gz[query]",
      algorithm: "gzip",
      test: /\.(js|css|json)$/,
      threshold: 8192,
      minRatio: 0.8,
      deleteOriginalAssets: true
    }));
  }
  return exports;
};

Webpack copy all files from src/static/ to path export (/data)/
In the src/static/dl folder contains json files.
Files js, css and 1 file json is compress.

from compression-webpack-plugin.

alexander-akait avatar alexander-akait commented on August 15, 2024

@MCMeGa you have minRatio, maybe ration original size with compressed above this value?

from compression-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.