WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/terser-webpack-plugin/README.md
@@ -815,6 +815,31 @@
};
```
### JSON
Uses `JSON.stringify()` to minify your JSON files during the build process.
**webpack.config.js**
```js
module.exports = {
  optimization: {
    minimize: true,
    minimizer: [
      // Keeps original terser plugin to minify JS files
      "...",
      // Will minify JSON files (they can come from copy-webpack-plugin or when you are using asset modules)
      new TerserPlugin({
        test: /\.json$/,
        minify: TerserPlugin.jsonMinify,
        // We are supporting `space` and `replacer` options, you can set them below
        terserOptions: {},
      }),
    ],
  },
};
```
### Custom Minify Function
Override the default minify function - use `uglify-js` for minification.